When I try to persist my JavaScript object to DynamoDB using the PutCommand
, I am seeing the following error message:
Error: Pass options.removeUndefinedValues=true to remove undefined values from map/array/set.
This happens when I use DynamoDBDocumentClient
When I use DynamoDBClient
then I must first marshal the object using marshall(..)
from @aws-sdk/util-dynamodb
. In this case the error is shown when I try to marshal the object.
When I print my object to the console, I don't see any undefined values. However, I don't see the complete object due to too many levels of nesting:
{ id: 123, child: { anotherChild: { nested: [Object] } } }
So instead I use JSON.stringify(..)
to display the entire object:
{
"id": 123,
"child": {
"anotherChild": {
"nested": {
"name": "Jane"
}
}
}
}
I apparently don't have any undefined attributes, so why am I seeing the error message?