Skip to content
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

"CredentialsProviderError: The SSO session associated with this profile has expired" in "overview" sample... #511

Closed
busticated opened this issue Nov 28, 2023 · 2 comments
Labels
bug Something isn't working fixed Issue has been fixed in the repo

Comments

@busticated
Copy link
Contributor

busticated commented Nov 28, 2023

hey there 👋

thanks for this awesome lib - it's really making working w/ DynamoDB a joy 🙏 ❤️ i'm trying to get my project up and running under DynamoDB Local for testing, etc. to that end, my first stop was to check out the samples in this repo.

Describe the bug

using the "overview" sample (link), i'm getting an odd error on start-up: "CredentialsProviderError: The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile." given that this sample targets DynamoDB Local, i didn't think you needed to provide valid credentials - from docs:

The AWS SDKs for DynamoDB require that your application configuration specify an access key value and an AWS Region value. Unless you're using the -sharedDb or the -inMemory option, DynamoDB uses these values to name the local database file. These values don't have to be valid AWS values to run locally. However, you might find it convenient to use valid values so that you can run your code in the cloud later by changing the endpoint you're using.

edit: i should also note that i get this same error even after logging in using: aws sso login --profile <my-profile>

Error details (click to expand)

>>make run
node dist/index.js
CredentialsProviderError: The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile.
    at resolveSSOCredentials (/Users/me/code/bust/dynamodb-onetable/samples/overview/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/resolveSSOCredentials.js:33:15)
    at async /Users/me/code/bust/dynamodb-onetable/samples/overview/node_modules/@smithy/property-provider/dist-cjs/chain.js:12:33
    at async coalesceProvider (/Users/me/code/bust/dynamodb-onetable/samples/overview/node_modules/@smithy/property-provider/dist-cjs/memoize.js:14:24)
    at async SignatureV4.credentialProvider (/Users/me/code/bust/dynamodb-onetable/samples/overview/node_modules/@smithy/property-provider/dist-cjs/memoize.js:33:24)
    at async SignatureV4.signRequest (/Users/me/code/bust/dynamodb-onetable/samples/overview/node_modules/@smithy/signature-v4/dist-cjs/SignatureV4.js:106:29)
    at async /Users/me/code/bust/dynamodb-onetable/samples/overview/node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js:16:18
    at async /Users/me/code/bust/dynamodb-onetable/samples/overview/node_modules/@smithy/middleware-retry/dist-cjs/retryMiddleware.js:27:46
    at async /Users/me/code/bust/dynamodb-onetable/samples/overview/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:7:26
    at async Dynamo.send (file:///Users/me/code/bust/dynamodb-onetable/dist/mjs/Dynamo.js:82:16)
    at async Dynamo.createTable (file:///Users/me/code/bust/dynamodb-onetable/dist/mjs/Dynamo.js:19:16) {
  tryNextLink: false,
  '$metadata': { attempts: 1, totalRetryDelay: 0 }
}

To Reproduce

using node@18.18.2 and npm@9.8.1 (the default that ships w/ v18 atm)...

repro steps:

  1. ensure you have fake aws_access_key_id and aws_secret_access_key key pairs set in your ~/.aws/credentials file
  2. clone down repo: $ git clone git@github.com:sensedeep/dynamodb-onetable.git
  3. check out the sha i used: $ git checkout 028a644711ad7bd42671531c965a2ff8b2861e37
  4. $ cd ./dynamodb-onetable/samples/overview
  5. install and build: $ make configure && make build
  6. run: $ make run

Expected behavior

Sample should run, tables and data should be created, logs should be printed to terminal

Environment (please complete the following information):

  • OS: macOS v14.1 (23B74) [intel]
  • Node Version: v18.18.2
  • OneTable Version: v2.7.1
  • TypeScript Version: v4.3.5
  • Any other relevant environment information:
>>npm ls --depth=0
onetable-sample-overview@1.0.0 /Users/me/code/bust/dynamodb-onetable/samples/overview
├── @aws-sdk/client-dynamodb@3.458.0
├── @aws-sdk/util-dynamodb@3.458.0
├── aws-sdk@2.954.0
├── dynamo-db-local@4.0.2
├── dynamodb-onetable@2.7.1
└── typescript@4.3.5
@busticated
Copy link
Contributor Author

looks like things work if i:

  1. manually set AWS env vars at the top of index.js like:
process.env['AWS_ACCESS_KEY_ID'] = 'fakeawsid'
process.env['AWS_SECRET_ACCESS_KEY'] = 'fakeawssecret'
  1. increase the delay() time to 5000 (5 sec) in index.js here

with the original 1s delay time, i ran into sporadic errors like:

Error: connect ECONNREFUSED 127.0.0.1:4567
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 4567,
  '$metadata': { attempts: 3, totalRetryDelay: 172 }
}

i'll pull together a PR with those + doc updates in case it's helpful.

@mobsense
Copy link
Contributor

mobsense commented Dec 4, 2023

Thank you.

@mobsense mobsense added bug Something isn't working fixed Issue has been fixed in the repo labels Dec 4, 2023
@mobsense mobsense closed this as completed Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Issue has been fixed in the repo
Projects
None yet
Development

No branches or pull requests

2 participants