Skip to content

Commit b2ced23

Browse files
mydeaclaude
andcommitted
fix(aws-serverless): Instrument aws-sdk clients using @smithy/core >= 3.24.0
`@smithy/core@3.24.0` moved the `Client` class out of `@smithy/smithy-client` into the `@smithy/core/client` bundle and turned `constructStack` into a closed-over local, so the vendored instrumentation - which created spans by wrapping `constructStack` exported from `@smithy/middleware-stack` - silently produced no spans for any AWS service on `@aws-sdk/*` >= 3.1046.0. This backports the upstream fix (open-telemetry/opentelemetry-js-contrib#3530, released in @opentelemetry/instrumentation-aws-sdk@0.74.0): * Patch `Client.prototype.send` in `@smithy/core/dist-cjs/submodules/client/index.js` for `@smithy/core` >= 3.24.0. * From within the `send` patch, patch the live `middlewareStack` instance directly (its `resolve` is the span-creation point) instead of relying on the no-longer-patchable `constructStack` export. * Guard `clone`/`concat` wrapping with `isWrapped` so repeated patching is safe. The aws-integration tests are consolidated into a single scenario that exercises all instrumented services, and run via `createEsmAndCjsTests` + `describe.each` against two dependency sets: * `latest` - the workspace `@aws-sdk/*` (`@smithy/core` >= 3.24.0, the new path) * `v3.1041.0` - aws-sdk 3.1041.0 pinned together with the pre-`@smithy/core` smithy stack via `additionalDependencies`, exercising the old `@smithy/middleware-stack` path Both run the same assertions in ESM and CJS, proving spans are produced on both architectures. Pinning only the client is not enough - `@smithy/smithy-client` must also be pinned < 4.13, otherwise it pulls `@smithy/core` >= 3.24.0 again. Fixes #21546 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4e7eb9a commit b2ced23

22 files changed

Lines changed: 749 additions & 1316 deletions

File tree

dev-packages/node-integration-tests/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
"dependencies": {
2626
"@anthropic-ai/sdk": "0.63.0",
2727
"@apollo/server": "^5.5.0",
28-
"@aws-sdk/client-dynamodb": "3.1041.0",
29-
"@aws-sdk/client-kinesis": "3.1041.0",
30-
"@aws-sdk/client-lambda": "3.1041.0",
31-
"@aws-sdk/client-s3": "3.1041.0",
32-
"@aws-sdk/client-secrets-manager": "3.1041.0",
33-
"@aws-sdk/client-sfn": "3.1041.0",
34-
"@aws-sdk/client-sns": "3.1041.0",
35-
"@aws-sdk/client-sqs": "3.1041.0",
28+
"@aws-sdk/client-dynamodb": "^3.1046.0",
29+
"@aws-sdk/client-kinesis": "^3.1046.0",
30+
"@aws-sdk/client-lambda": "^3.1046.0",
31+
"@aws-sdk/client-s3": "^3.1046.0",
32+
"@aws-sdk/client-secrets-manager": "^3.1046.0",
33+
"@aws-sdk/client-sfn": "^3.1046.0",
34+
"@aws-sdk/client-sns": "^3.1046.0",
35+
"@aws-sdk/client-sqs": "^3.1046.0",
3636
"@google/genai": "^1.20.0",
3737
"@growthbook/growthbook": "^1.6.1",
3838
"@hapi/hapi": "^21.3.10",

dev-packages/node-integration-tests/suites/aws-serverless/aws-integration/dynamodb/scenario.js

Lines changed: 0 additions & 52 deletions
This file was deleted.

dev-packages/node-integration-tests/suites/aws-serverless/aws-integration/dynamodb/test.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import * as Sentry from '@sentry/aws-serverless';
2+
import { loggingTransport } from '@sentry-internal/node-integration-tests';
3+
4+
Sentry.init({
5+
dsn: 'https://public@dsn.ingest.sentry.io/1337',
6+
release: '1.0',
7+
tracesSampleRate: 1.0,
8+
transport: loggingTransport,
9+
});

dev-packages/node-integration-tests/suites/aws-serverless/aws-integration/kinesis/scenario.js

Lines changed: 0 additions & 41 deletions
This file was deleted.

dev-packages/node-integration-tests/suites/aws-serverless/aws-integration/kinesis/test.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

dev-packages/node-integration-tests/suites/aws-serverless/aws-integration/lambda/scenario.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

dev-packages/node-integration-tests/suites/aws-serverless/aws-integration/lambda/test.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

dev-packages/node-integration-tests/suites/aws-serverless/aws-integration/s3/scenario.js

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)