Diego
Diego

Reputation: 558

AWS SDK v3 TransactWriteItemsCommand TypeError: Cannot read property '0' of undefined

I am trying to use TransactWriteItemsCommand to work using the new AWS SDK V3 for NodeJS. Unfortunately I can't find an example and the docs are not really well documented yet.

This is my params object:

    {
        "TransactItems": [
            {
                "Update": {
                    "TableName": "boxes",
                    "Key": {
                        "id": "36"
                    },
                    "UpdateExpression": "set isOpen = :isOpen",
                    "ExpressionAttributeValues": {
                        ":isOpen": {
                            "BOOL": true
                        }
                    }
                }
            },
            {
                "Update": {
                    "TableName": "boxes",
                    "Key": {
                        "id": "33"
                    },
                    "UpdateExpression": "set isOpen = :isOpen",
                    "ExpressionAttributeValues": {
                        ":isOpen": {
                            "BOOL": true
                        }
                    }
                }
            }
        ]
    }

What I'm doing wrong? Any help would be appreciated!

Upvotes: 3

Views: 1711

Answers (1)

Diego
Diego

Reputation: 558

Thanks to @flanamacca for the answer

The problem is the format of the key because I'm not using DynamoDB JSON format.

   "Key": {
    "id": {"S": "36"}
   },

Upvotes: 4

Related Questions