-
Notifications
You must be signed in to change notification settings - Fork 646
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
In AWS SDK for JavaScript conventions, a Client may be used to send one or more Commands.
e.g.
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
const client = new S3Client();
const params = { ... };
const command = new GetObjectCommand(params);
await client.send(command);Command reuse is the act of sending a command more than once in the same client, e.g.
const command = new GetObjectCommand({ ... });
await client.send(command);
await client.send(command);
await client.send(command);Because commands only save a reference to their input params, it is possible to change params between repeated calls to client.send.
const command = new GetObjectCommand({ ... });
const response1 = await client.send(command);
params.Key = "2";
const response2 = await client.send(command);
params.Key = "3";
const response3 = await client.send(command);Regression Issue
- Select this option if this issue appears to be a regression.
SDK version number
@aws-sdk/lib-dynamodb@3.778.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
any supported version
Reproduction Steps
In v3.778.0 of @aws-sdk/lib-dynamodb, the DynamoDBDocumentClient attributeValue wrapper class broke the usage pattern of Command reuse.
We are applying a patch in #7216 to formalize and protect the ability to reuse Commands.
Observed Behavior
Reused Commands from the DynamoDBDocumentClient would undergo the marshalling transform more than once, leading to incorrect serialized data.
The transform is specific to this high-level Client and does not affect other clients or other services.
Expected Behavior
Command class instances from @aws-sdk/lib-dynamodb for the DynamoDBDocumentClient wrapper client should be reusable.
Possible Solution
Fix applied in #7216
Additional Information/Context
No response