Error: dynamodb put function not working

Answered by Rafal Wilinski
What's Causing This Error
This error mainly occurs with the AWS JavaScript SDK when the put()
function is used as a promise-based function.
For example, suppose you are executing the put()
in a Lambda function and do not wait for it to finish running. The Lambda function will immediately return a response, but the put()
will not get executed.
Solution - Here's How To Resolve It
To resolve the error, use an async-await approach as shown below.
exports.handler = async (event) => { const obj = { pk: '1', name: "Lakindu" }; const response = { statusCode: 200, body: JSON.stringify(obj), }; var params = { 'TableName':'test-table', 'Item': { ...obj }, }; // await the promise and then await the result, so the function gets invoked. await documentClient.put(params).promise(); return response; };
Other Common DynamoDB Errors (with Solutions)
- dynamodb unknown error
- dynamodb cannot create preexisting table
- DynamoDB Local NoClassDefFoundError
- Unable to start DynamoDB Local process
- DynamoDB failedbatch retry
- ValidationException: Invalid KeyConditionExpression: Attribute name is a reserved keyword;
- dynamodb getItem() is not a function
- 'dynamodb' object has no attribute 'table'
- dynamodb docker unable to open database file
- Boto3 DynamoDB KeyError
- dynamodb cannot read property 'push' of undefined
- DynamoDB Update Not Working
- could not unmarshal the value dynamodb
- name key is not defined dynamodb
- DynamoDB Expression Not Null
Login to the AWS Console less. Use Dynobase.
Try 7-day free trial. No credit card needed.
Product Features
DynamoDB Tools
DynamoDB Info
© 2025 Dynobase