Step function putItem DynamoDB

0

Hi, I'm using step function with task DynamoDB:PutItem. When Step function try to save the JSON

 {
    "TableName": "Table_Name",
    "Item": {
      "orderId": "159844346634674",
      "mail": "test@test.com",
      "itemId": "876434",
      "channel": "Retail",
      "createdDate": 1234512345
    }

It receive the following error:

could not be used to start the Task: [Cannot construct instance of com.amazonaws.services.dynamodbv2.model.AttributeValue (although at least one Creator exists): no int/Int-argument constructor/factory method to deserialize from Number value (1234512345)]

The field createdDate into DynamoDB have type "N".

Do you have any suggestion to fix this issue?

Thanks

2개 답변
0

Hi, DynamoDB expects the value of 'N' to be a string. You can read more about how DynamoDB handles numeric data in the Low-Level API docs here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.LowLevelAPI.html#Programming.LowLevelAPI.Numbers

If you use the following, the task should succeed:

{
    "TableName": "Table_Name",
    "Item": {
      "orderId": "159844346634674",
      "mail": "test@test.com",
      "itemId": "876434",
      "channel": "Retail",
      "createdDate": "1234512345"
    }
AWS
전문가
Parnab
답변함 2년 전
0

The error means that that there is no method to serialize the String in request to a number

Can you change the json to the one below and check again?


{ "TableName": "Table_Name", "Item": { "orderId": "159844346634674", "mail": "test@test.com", "itemId": "876434", "channel": "Retail", "createdDate": { "N": 1234512345 } }

AWS
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠