Error: dynamodb put item not working

Answered by Rafal Wilinski
What's Causing This Error
This error mainly occurs with the AWS JavaScript SDK when putItem() function is used as a promise-based function.
For example, suppose you are executing the putItem() in a Lambda function and do not wait until the execution is complete. The Lambda function will immediately return a response, but the putItem() 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':'dynobase-article-demo',
'Item': {
'pk': {
N: obj.pk
},
'name': {
S: obj.name
}
},
'ReturnConsumedCapacity': "TOTAL"
};
// await for the put item so that it becomes synchronous.
await dynamodb.putItem(params).promise();
return response;
};
Other Common DynamoDB Errors (with Solutions)
- DynamoDB missing items
- dynamodb list_append if_not_exists not working
- name key is not defined dynamodb
- AWS DynamoDB errors ResourceNotFoundException
- dynamodb put function not working
- DynamoDB Query Limit Not Working
- DynamoDB ConditionalCheckFailedException
- dynamodb cannot read property 'push' of undefined
- 'dynamodb' object has no attribute 'table'
- DynamoDB stream not working
- DynamoDB Item Does Not Exist
- DynamoDB failedbatch retry
- dynamodb cannot read property 's' of undefined
- DynamoDB No Regionendpoint Or Serviceurl Configured
- aws.dynamodb.converter.unmarshall not working
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
- New in Dynobase 3.0
- Semantic and Vector Search
- Schema Explorer
- Visual JSON Path Filtering
- Visual Item Diff
- MCP Server for AI Tools
- Use SQL with DynamoDB
- Import CSV To DynamoDB
- Import JSON To DynamoDB
- Export DynamoDB To JSON
- Export DynamoDB To S3
- Export DynamoDB To CSV
- DynamoDB Update Item
- DynamoDB Delete All Items
- DynamoDB Delete Item
- DynamoDB Create Table
- DynamoDB Delete Table
- DynamoDB Conditional Update
DynamoDB Tools
DynamoDB Info
© 2026 Dynobase