dynobase-icon
Dynobase

Error: dynamodb cannot convert undefined to object

Rafal Wilinski

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.

See JavaScript client examples and AWS documentation.

Dynobase is a Professional GUI Client for DynamoDB

Start your 7-day free trial today

Product Features

Download
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2026 Dynobase
+
Still using AWS DynamoDB Console?
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.