aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.04k stars 569 forks source link

AwsSdkSigV4Signer is not a constructor when instantiating SSMClient #6273

Open pdguru81 opened 2 months ago

pdguru81 commented 2 months ago

Checkboxes for prior research

Describe the bug

When I attempt tp instantiate system params client, I get the error below on lambda nodejs 18

const ssm = new SSMClient({ region: process.env.REGION });
2024-07-12T03:30:31.273Z    undefined   ERROR   Uncaught Exception  {"errorType":"TypeError","errorMessage":"HIt.AwsSdkSigV4Signer is not a constructor","stack":["TypeError: HIt.AwsSdkSigV4Signer is not a constructor","    at ZIt (/var/task/index.js:29:10634)","    at mPt (/var/task/index.js:29:11327)","    at new SSMClient (/var/task/index.js:29:39822)","    at /var/task/index.js:37:270790","    at /var/task/index.js:1:263","    at Object.<anonymous> (/var/task/index.js:96:481488)","    at Module._compile (node:internal/modules/cjs/loader:1358:14)","    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)","    at Module.load (node:internal/modules/cjs/loader:1208:32)","    at Module._load (node:internal/modules/cjs/loader:1024:12)"]}
INIT_REPORT Init Duration: 498.25 ms    Phase: init Status: error   Error Type: Runtime.Unknown
2024-07-12T03:30:39.166Z    undefined   ERROR   Uncaught Exception  {"errorType":"TypeError","errorMessage":"HIt.AwsSdkSigV4Signer is not a constructor","stack":["TypeError: HIt.AwsSdkSigV4Signer is not a constructor","    at ZIt (/var/task/index.js:29:10634)","    at mPt (/var/task/index.js:29:11327)","    at new SSMClient (/var/task/index.js:29:39822)","    at /var/task/index.js:37:270790","    at /var/task/index.js:1:263","    at Object.<anonymous> (/var/task/index.js:96:481488)","    at Module._compile (node:internal/modules/cjs/loader:1358:14)","    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)","    at Module.load (node:internal/modules/cjs/loader:1208:32)","    at Module._load (node:internal/modules/cjs/loader:1024:12)"]}
INIT_REPORT Init Duration: 830.34 ms    Phase: invoke   Status: error   Error Type: Runtime.Unknown
START RequestId: 71155d93-2c59-4118-a368-ff59763c7962 Version: $LATEST
Unknown application error occurred
Runtime.Unknown
END RequestId: 71155d93-2c59-4118-a368-ff59763c7962
REPORT RequestId: 71155d93-2c59-4118-a368-ff59763c7962  Duration: 831.22 ms Billed Duration: 832 ms Memory Size: 1024 MB    Max Memory Used: 114 MB 

SDK version number

@aws-sdk/client-ssm@3.603.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

18.20.2

Reproduction Steps

Attempt to call SSMClient on lambda 18.2.0

Observed Behavior

This call fails: const ssm = new SSMClient({ region: process.env.REGION });

Expected Behavior

It should instantiate the SSMClient without errors

Possible Solution

No response

Additional Information/Context

No response

aBurmeseDev commented 1 month ago

Hi @pdguru81 - thanks for reaching out.

Can you please provide a minimal reproducible code for us to further review this behavior? I wasn't able to reproduce the issue on my end or find any outstanding issue reports.

Sepehr-Qrvey commented 1 month ago

This issue seems to be caused by a backwards incompatibility of the recent versions of the sdk clients with older version of the @aws-sdk/core. For us, the issue was caused by having a client-sqs with v3.620 in one layer, and then client-sts with v3.470 in another layer, and the client from the first layer tries to call the @aws-sdk/core from the second layer and throws this error.