DocumentClient incorrectly marshalls binary data types when using convertClassInstanceToMap: true
#5824
Closed
3 tasks done
Labels
Checkboxes for prior research
Describe the bug
When writing data using
DynamoDBDocumentClient
withmarshallOptions.convertClassInstanceToMap = true
, binary data values are incorrectly written to Dynamo as the"M"
(map) data type rather than the"B"
(binary) data type.SDK version number
@aws-sdk/lib-dynamodb@3.504.0
Which JavaScript Runtime is this issue in?
All
Details of the browser/Node.js/ReactNative version
All
Reproduction Steps
Observed Behavior
The marshalled DynamoDB JSON that is written to the database for the
data
attribute contains a Map whose value is equivalent to the result of converting the Buffer to a plain object by iterating over its keys usingObject.entries
:Expected Behavior
The marshalled DynamoDB JSON that is written to the database should contain the
data
attribute as a binary value:Possible Solution
This bug was introduced with #5697 which blindly converts anything that has
typeof
ofobject
into a plain JS object.This fails to account for the fact that there are a large number of types that fit this signature but should be left intact, as is accounted for here and here.
I'd imagine this change has also broken marshalling for other data type such as
Set
.Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: