- Symptom
- Error: Pass options.removeUndefinedValues=true to remove undefined values from map/array/set.Same item shape saved fine with the v2 DocumentClientFails only when an optional field is undefined
- Cause
- The v3 marshaller refuses undefined values by default instead of dropping them. The option is set when you create the document client, not per call.
- Fix
- Create the document client with removeUndefinedValues true, or strip undefined fields before the write.
- Apply
import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb'; const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({}), { marshallOptions: { removeUndefinedValues: true }, });- Affected
- @aws-sdk/lib-dynamodb and @aws-sdk/util-dynamodb, all v3 releases
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders