Error: dynamodb put function not working

Answered by Rafal Wilinski
Last updated: October 23rd, 2026
Solution
A DynamoDB put can appear not to run when asynchronous work is not awaited, the wrong client API is used, or the write goes to another table or endpoint. Await the request and inspect its error before returning from the function.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, PutCommand } from "@aws-sdk/lib-dynamodb";
const db = DynamoDBDocumentClient.from(new DynamoDBClient({}));
export const handler = async () => {
const item = { pk: "1", name: "Lakindu" };
await db.send(new PutCommand({ TableName: "People", Item: item }));
return { statusCode: 200, body: JSON.stringify(item) };
};This example assumes People has a String partition key named pk. SDK v2 DocumentClient.put returned a request that needed a callback or .promise(); v3 uses send and needs no .promise(). Keep the SDK client outside the handler for reuse.
A successful PutCommand does not return the new item by default. Verify with a strongly consistent GetItem against the base table and complete key. Check conditions, credentials and Region if it fails. Put replaces an existing item at the same key; use UpdateItem for a partial change.
See put versus update and AWS documentation.
Other Common DynamoDB Errors (with Solutions)
- DynamoDB Error All Attributes Must Be Indexed
- DynamoDB Error 413
- DynamoDB Expression Not Null
- DynamoDB batch write is not working
- dynamodb getItem() is not a function
- DynamoDB stream lambda error
- dynamodb condition does not exist
- dynamodb unable to execute http request
- dynamodb cannot convert undefined to object
- DynamoDB scan does not return all items
- AWS DynamoDB CredentialsError: Missing credentials in config
- DynamoDB throttling error
- dynamodb list_append returns true but does not work
- DynamoDB TTL Not Working
- boto3 dynamodb unable to locate credentials
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today