AWS NodeJS SDK V3 DynamoDB UpdateItem — TypeError: Cannot read property ‘0’ of undefined \n at Object.AttributeValue.visit

Hi there, if you are running into this issue, you are at the right place to fix this and I hope I can help you.

With DynamoDB v3 is a bit different when it comes to defining your params object.

Error message:

Dynamodb v3 updateItem error

Solutions:

  1. Make sure your key format is correct by including the type of your key. For example: PK: { S: `USER#1234` }
  2. Make sure ExpressionAttributeValues is also including the type of your key. For example: “:title”: { S: body.title }

Example:

dynamoDB-v3-updateItem

Please let me know if you still have an issue via Twitter or LinkedIn

Nadtakan Futhoem — Serverless Developer

Founder of Nadtakan.com & Serverless Cloud developer. Follow me on Twitter https://twitter.com/NadtakanF