Error: dynamodb cannot convert undefined to object

Answered by Rafal Wilinski
Last updated: October 23rd, 2026
Solution
Cannot convert undefined or null to object means JavaScript code expected an object but received a missing value. Around DynamoDB, common triggers are enumerating a missing Item, marshalling undefined, or constructing an invalid request map.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, GetCommand } from "@aws-sdk/lib-dynamodb";
const db = DynamoDBDocumentClient.from(new DynamoDBClient({}));
const response = await db.send(new GetCommand({
TableName: "People", Key: { pk: "person-1" },
}));
if (response.Item === undefined) {
console.log("No matching item");
} else {
console.log(Object.keys(response.Item));
}Start with the first relevant stack frame. Check that the asynchronous request was awaited and that the code uses Item for GetCommand and Items for QueryCommand or ScanCommand. Validate required request fields before calling the SDK.
The v3 marshalling option removeUndefinedValues can omit undefined attributes inside valid data structures. It does not create a missing Item object or repair an undefined primary key. Use an empty-object fallback only when absence is valid in the application, not to conceal a malformed response or request.
Other Common DynamoDB Errors (with Solutions)
- dynamodb cannot assign requested address
- dynamodb request is missing authentication token
- DynamoDB is missing the key id in the item
- dynamodb could not connect to the endpoint url
- dynamodb put item not working
- DynamoDB validation error
- DynamoDB Query Limit Not Working
- DynamoDB ConditionExpression not working
- boto3 dynamodb unable to locate credentials
- error dynamodb streams must be enabled on the table
- DynamoDB Mapper Could Not Instantiate Class
- dynamodb system errors metric
- ImportError: No module named boto3 (DynamoDB)
- DynamoDB local error unable to access JAR file dynamodblocal.jar
- Boto3 DynamoDB KeyError
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today