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 1 validation error detected value
- dynamodb unable to locate credentials
- failed to list tables not authorized dynamodb
- DynamoDB Error Message KeyError item is not JSON serializable
- dynamodb could not instantiate class
- DynamoDB Local Missing Authentication Token
- DynamoDB Error 413
- dynamodb cannot read property 'push' of undefined
- DynamoDB Local Cannot Create Preexisting Table
- name key is not defined dynamodb
- AWS Lambda DynamoDB Stream Error
- dynamodb converter not found for enhancedtype
- DynamoDB Is Not Null
- ExpressionAttributeValues contains invalid value: One or more parameter values were invalid: An AttributeValue may not contain an empty string
- 'dynamodb' object has no attribute 'table'
Login to the AWS Console less. Use Dynobase.
Try 7-day free trial. No strings attached.
Product Features
DynamoDB Tools
DynamoDB Info
© 2025 Dynobase