aws-sdk-js-v3: TypeError: Cannot read properties of undefined (reading 'sso_session')
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
Start getting this error when deploying to AWS Elastic Beanstalk. I am trying to access Secret Manager.
SDK version number
“@aws-sdk/client-secrets-manager”: “^3.209.0”
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v16.18.0
Reproduction Steps
- Deploy the AWS Secret Manager node.js sample code to Elastic Beanstalk.
- You will see the error when trying to get the secret.
Observed Behavior
Nov 13 22:30:24 ip-10-0-2-9 web: TypeError: Cannot read properties of undefined (reading 'sso_session')
Nov 13 22:30:24 ip-10-0-2-9 web: at /var/app/current/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/fromSSO.js:15:21
Nov 13 22:30:24 ip-10-0-2-9 web: at async coalesceProvider (/var/app/current/node_modules/@aws-sdk/property-provider/dist-cjs/memoize.js:14:24)
Nov 13 22:30:24 ip-10-0-2-9 web: at async SignatureV4.credentialProvider (/var/app/current/node_modules/@aws-sdk/property-provider/dist-cjs/memoize.js:33:24)
Nov 13 22:30:24 ip-10-0-2-9 web: at async SignatureV4.signRequest (/var/app/current/node_modules/@aws-sdk/signature-v4/dist-cjs/SignatureV4.js:86:29)
Nov 13 22:30:24 ip-10-0-2-9 web: at async /var/app/current/node_modules/@aws-sdk/middleware-signing/dist-cjs/middleware.js:16:18
Nov 13 22:30:24 ip-10-0-2-9 web: at async StandardRetryStrategy.retry (/var/app/current/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:51:46)
Nov 13 22:30:24 ip-10-0-2-9 web: at async /var/app/current/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:6:22
Nov 13 22:30:24 ip-10-0-2-9 web: at async getAWSSecrets (/var/app/current/packages/server/dist/infrastructure/settings/config.factory.js:104:21)
Nov 13 22:30:24 ip-10-0-2-9 web: at async InstanceWrapper.ConfigAWSFactory [as metatype] (/var/app/current/packages/server/dist/infrastructure/settings/config.factory.js:61:21)
Nov 13 22:30:24 ip-10-0-2-9 web: at async Injector.instantiateClass (/var/app/current/node_modules/@nestjs/core/injector/injector.js:344:37)
Expected Behavior
Retrieve the secret without errors.
Possible Solution
Probably caused by this change https://github.com/aws/aws-sdk-js-v3/pull/4145/files#r1020812785 on https://github.com/aws/aws-sdk-js-v3/pull/4145
Additional Information/Context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 18
- Comments: 18 (2 by maintainers)
Thank you for reporting this error. I have submitted a fix to be released today, with added unit tests.
You’re right - working now.
I tried the below version and it works!
“@aws-sdk/client-s3”: “3.135.0”, “@aws-sdk/s3-request-presigner”: “3.135.0”
Issue still exists in 3.210.0
#4192 includes reproduction
Indeed it works @lahuman !!! thanks
The error message in #4192 is for v3.209.0 of the module - it shows the error as being on line 15, character 25, which is the location of the issue in the previous version:
https://unpkg.com/browse/@aws-sdk/credential-provider-sso@3.209.0/dist-cjs/fromSSO.js
The new v3.210.0 doesn’t access
sso_session
on line 15:https://unpkg.com/browse/@aws-sdk/credential-provider-sso@3.210.0/dist-cjs/fromSSO.js
Most likely that means that you have an older version of
@aws-sdk/credential-provider-sso
in your lockfile ornode_modules
, if your lockfile only has the new 3.210.0, you might try deleting yournode_modules
directory and reinstalling.Note if you have the
^
in your package.json you are telling npm it’s okay to install 3.208.0 any anything above., i.e. the broken 3.209.0, so it still won’t work.You have to explicitly have “3.208.0” in your package.json
the workaround is to pin the version to
3.208.0
: