Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unmarshall dynamodb item is throwing Unsupported type passed: Nul #4948

Closed
3 tasks done
anjali89r opened this issue Jul 11, 2023 · 6 comments
Closed
3 tasks done

Unmarshall dynamodb item is throwing Unsupported type passed: Nul #4948

anjali89r opened this issue Jul 11, 2023 · 6 comments
Assignees
Labels
closed-for-staleness response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Comments

@anjali89r
Copy link

Checkboxes for prior research

Describe the bug

I'm using the unmarshall method from the "@aws-sdk/util-dynamodb" and it is throwing the below error for some of the items,

Unsupported type passed: Nul

@aws-sdk/util-dynamodb version: 3.365.0

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

18.14

Reproduction Steps

I'm trying to unmarshal this item returned from the dynamodb db

import { unmarshall } from "@aws-sdk/util-dynamodb";
const testItem = {
  "Email": { "S": "[email protected]" },
  "Address": {
    "M": {
      "pincode": { "S": "test" },
      "country": { "S": "test" },
      "town": { "S": "test" },
      "streetAddress": { "S": "test" },
      "district": { "S": "" },
      "landmarkAddress": { "S": "test" },
      "state": { "S": "test" }
    }
  },
  "GSI2-SK": { "S": "2023-07-10T21:37:18.680Z" },
  "GSI1-SK": { "S": "2023-07-10T21:37:18.680Z" },
  "GSI2-PK": { "S": "e#[email protected]" },
  "GSI1-PK": { "S": "c#RECEIVED" },
  "Date": { "S": "2023-07-10T21:22:27.088Z" },
  "Name": { "S": "test" },
  "EntityType": { "S": "cart" },
  "SK": { "S": "c#RECEIVED" },
  "PhoneNumber": { "S": "+44-12345677" },
  "PK": { "S": "c#test" },
  "Detail": {
    "L": [
      {
        "M": {
          "subCategory": { "S": "stitched" },
          "color": { "S": "Cream" },
          "gender": { "S": "Women" },
          "description": {
            "S": "test"
          },
          "discount": { "Nul": true },
          "video": { "L": [] },
          "relatedItem": { "Nul": true },
          "categoryName": { "S": "teest" },
          "sku": { "S": "KWSC40880430" },
          "brand": { "S": "test" },
          "disclaimer": {
            "S": "test"
          },
          "itemSpecificMessage": { "S": "" },
          "materialType": { "S": "test" },
          "availableStock": { "N": "1" },
          "itemDetails": {
            "L": [
              {
                "S": "test"
              },
              {
                "S": "test"
              },
              {
                "S": "test"
              },
              { "S": "test" },
              {
                "S": "test"
              }
            ]
          },
          "specification": {
            "L": [
              {
                "M": {
                  "itemid": { "S": "test" },
                  "color": { "S": "teset" },
                  "groupCategory": { "S": "Size" },
                  "count": { "N": "5" },
                  "groupValue": { "S": "M" }
                }
              },
              {
                "M": {
                  "itemid": { "S": "test" },
                  "color": { "S": "Cream" },
                  "groupCategory": { "S": "Size" },
                  "count": { "N": "5" },
                  "groupValue": { "S": "XL" }
                }
              },
              {
                "M": {
                  "itemid": { "S": "test" },
                  "color": { "S": "Cream" },
                  "groupCategory": { "S": "Size" },
                  "count": { "N": "5" },
                  "groupValue": { "S": "XXL" }
                }
              },
              {
                "M": {
                  "itemid": { "S": "40" },
                  "color": { "S": "" },
                  "rate": { "N": "0" },
                  "groupCategory": { "S": "Size" },
                  "count": { "N": "5" },
                  "groupValue": { "S": "L" }
                }
              },
              {
                "M": {
                  "itemid": { "S": "46" },
                  "color": { "S": "" },
                  "rate": { "N": "2600" },
                  "groupCategory": { "S": "size" },
                  "count": { "N": "5" },
                  "groupValue": { "S": "3xl" }
                }
              },
              {
                "M": {
                  "itemid": { "S": "48" },
                  "color": { "S": "" },
                  "rate": { "N": "2810" },
                  "groupCategory": { "S": "size" },
                  "count": { "N": "5" },
                  "groupValue": { "S": "4xl" }
                }
              },
              {
                "M": {
                  "itemid": { "S": "50" },
                  "color": { "S": "" },
                  "rate": { "N": "2985" },
                  "groupCategory": { "S": "size" },
                  "count": { "N": "5" },
                  "groupValue": { "S": "5xl" }
                }
              }
            ]
          },
          "qtySel": { "N": "1" },
          "maxRate": { "Nul": true },
          "selectedSpecification": {
            "M": {
              "itemid": { "S": "40" },
              "color": { "S": "" },
              "rate": { "N": "0" },
              "groupCategory": { "S": "Size" },
              "count": { "N": "5" },
              "groupValue": { "S": "L" }
            }
          },
          "url": { "S": "test" },
          "itemId": { "S": "test" },
          "madeToOrderText": { "Nul": true },
          "size": { "Nul": true },
          "imageUrls": {
            "L": [
              {
                "S": "test"
              },
              {
                "S": "test"
              },
              {
                "S": "test"
              },
              {
                "S": "test"
              }
            ]
          },
          "madeToOrder": { "S": "Yes" },
          "name": { "S": "test" },
          "itemServices": { "L": [] },
          "retailRate": { "N": "2595" },
          "status": { "S": "active" }
        }
      }
    ]
  }
}
console.log(unmarshall(testItem))

Observed Behavior

Unsupported type passed: Nul

Expected Behavior

Successfully unmarshal and return javascript object

Possible Solution

No response

Additional Information/Context

I have seen a similar issue reported for marshal method and it was closed

@anjali89r anjali89r added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 11, 2023
@yenfryherrerafeliz
Copy link
Contributor

Hi @anjali89r, sorry to hear about your issues. Basically the error is that the type "Nul" is not valid, did you mean to put NULL there?. You can find the valid types in the documentation here.

I hope this helps!

Thanks!

@yenfryherrerafeliz yenfryherrerafeliz self-assigned this Jul 11, 2023
@yenfryherrerafeliz yenfryherrerafeliz added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 11, 2023
@anjali89r
Copy link
Author

thanks @yenfryherrerafeliz . The Nul value is returned by the Dynamodb query call when integrated with the step function. I'm just passing this to the Lambda and trying to unmarshall it using this lib.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Jul 13, 2023
@loic-omaze
Copy link

@anjali89r I have the same issue. Did you figure out how to fix this?

@yenfryherrerafeliz
Copy link
Contributor

Hi @anjali89r, sorry for the delay. Could you please provide more details about how you get that result so I can reproduce it on my end?, for example if you do a getItem call with the dynamodb client, could you please provide the sample code for this?. The same for you @loic-omaze, could you please provide more details of how to reproduce your issue?

Thanks!

@yenfryherrerafeliz yenfryherrerafeliz added the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Sep 8, 2023
@github-actions
Copy link

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Sep 16, 2023
@github-actions
Copy link

github-actions bot commented Oct 4, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
closed-for-staleness response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants