Skip to content

fix(lib-dynamodb): support command reuse #7216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2025
Merged

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Jul 18, 2025

Issue

#7217

Description

This fix supports reuse of Command class instances, particularly in the special case of the @aws-sdk/lib-dynamodb DynamoDBDocumentClient.

Currently, the reuse of Command class instances is undefined behavior.

Example of command reuse:

import { DynamoDBDocumentClient, GetCommand } from "@aws-sdk/lib-dynamodb";
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";

const ddb = new DynamoDBClient();
const doc = DynamoDBDocumentClient.from(ddb);

const get = new GetCommand({ ... });

await doc.send(get);
await doc.send(get);

https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/javascript_dynamodb_code_examples.html

We had previously expected each send call to receive a new instance of the Command in question, but now recognize the possibility of reusing command instances.

Testing

added integ tests

@kuhe kuhe requested a review from a team as a code owner July 18, 2025 20:39
@zshzbh zshzbh linked an issue Jul 18, 2025 that may be closed by this pull request
4 tasks
@kuhe kuhe force-pushed the fix/command-reuse branch from d2bb8a0 to e042379 Compare July 18, 2025 22:14
@kuhe kuhe force-pushed the fix/command-reuse branch from e042379 to d22b285 Compare July 18, 2025 22:17
@kuhe kuhe merged commit 24e5b28 into aws:main Jul 21, 2025
4 checks passed
@kuhe kuhe deleted the fix/command-reuse branch July 21, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants