DynamoDBDocumentClient throws on marshalling of class instances where class includes bound functions or arrow functions, despite convertClassInstanceToMap = true #5686
Labels
bug
This issue is a bug.
p2
This is a standard priority issue
queued
This issues is on the AWS team's backlog
workaround-available
This issue has a work around available.
Checkboxes for prior research
Describe the bug
[ Edited to include bound functions ]
An error is now thrown If bound or arrow functions are included as part of a class, when an instance of that class is used in PutCommand, BatchWriteCommand, DeleteCommand, etc. Example of error 'Unsupported type passed: () => this.props. Pass options.convertClassInstanceToMap=true to marshall typeof object as map attribute.'
SDK version number
@aws-sdk/lib-dynamodb@3.490.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v18.17.1
Reproduction Steps
Observed Behavior
Error: Unsupported type passed: () => this.props. Pass options.convertClassInstanceToMap=true to marshall typeof object as map attribute.
at convertToAttr (/Volumes/wx/code/iotv/lws/node_modules/@aws-sdk/util-dynamodb/dist-cjs/convertToAttr.js:53:11)
at marshall (/Volumes/wx/code/iotv/lws/node_modules/@aws-sdk/util-dynamodb/dist-cjs/marshall.js:6:62)
at marshallFunc (/Volumes/wx/code/iotv/lws/node_modules/@aws-sdk/lib-dynamodb/dist-cjs/commands/utils.js:64:71)
at processObj (/Volumes/wx/code/iotv/lws/node_modules/@aws-sdk/lib-dynamodb/dist-cjs/commands/utils.js:12:20)
at /Volumes/wx/code/iotv/lws/node_modules/@aws-sdk/lib-dynamodb/dist-cjs/commands/utils.js:56:32
at Array.reduce ()
at processAllKeysInObj (/Volumes/wx/code/iotv/lws/node_modules/@aws-sdk/lib-dynamodb/dist-cjs/commands/utils.js:55:32)
at processObj (/Volumes/wx/code/iotv/lws/node_modules/@aws-sdk/lib-dynamodb/dist-cjs/commands/utils.js:23:24)
at processKeysInObj (/Volumes/wx/code/iotv/lws/node_modules/@aws-sdk/lib-dynamodb/dist-cjs/commands/utils.js:44:32)
at marshallInput (/Volumes/wx/code/iotv/lws/node_modules/@aws-sdk/lib-dynamodb/dist-cjs/commands/utils.js:65:12)
Expected Behavior
putRes {
'$metadata': {
httpStatusCode: 200,
requestId: 'NM3UDHU0BFC0766O6NBHE8V6GNVV4KQNSO5AEMVJF66Q9ASUAAJG',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
}
}
Possible Solution
No response
Additional Information/Context
This seems to be a change in behavior from recent versions of @aws-sdk/lib-dynamodb. It was picked up because of a manual change made to a Lamdba's environment variables in the aws console. Which presumably allowed lambda to relaunch with new package versions.
I am not sure if its a bug or by design, can't find any reference to it.
The text was updated successfully, but these errors were encountered: