Skip to content

fix(lib-dynamodb): conditionally clone middleware stack when cacheMiddleware is enabled#7801

Open
TrevorBurnham wants to merge 1 commit intoaws:mainfrom
TrevorBurnham:fix/dynamodb-doc-client-cache-middleware-compat
Open

fix(lib-dynamodb): conditionally clone middleware stack when cacheMiddleware is enabled#7801
TrevorBurnham wants to merge 1 commit intoaws:mainfrom
TrevorBurnham:fix/dynamodb-doc-client-cache-middleware-compat

Conversation

@TrevorBurnham
Copy link
Copy Markdown
Contributor

Previously: #7762

Currently, setting cacheMiddleware: true on DynamoDBDocumentClient causes a runtime error.

With this PR, that setting causes the middleware stack from the parent to be cloned, allowing it to be cached. When cacheMiddleware is false (the default), the existing shared-reference behavior is preserved.

Checklist

  • If the PR is a feature, add integration tests (*.integ.spec.ts) or E2E tests.
    • It's not a feature.
  • My E2E tests are resilient to concurrent i/o.
    • I didn't write any E2E tests.
  • I added access level annotations e.g. @public, @internal tags and enabled doc generation on the package. Remember that access level annotations go below the description, not above.
    • I didn't add any public functions.
  • Streams - how do they work?? My WebStream readers/locks are properly lifecycled. Node.js stream backpressure is handled. Error handling.
    • No streams here.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…dleware is enabled

When cacheMiddleware: true is set on the parent DynamoDBClient, the
document client now clones the middleware stack at construction time.
This prevents cached handlers from going stale due to shared-stack
mutations.

When cacheMiddleware is false (the default), the existing shared-reference
behavior is preserved, ensuring full backward compatibility.
@TrevorBurnham TrevorBurnham requested a review from a team as a code owner March 1, 2026 02:15
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.

1 participant