sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.09k stars 128 forks source link

AWS CredentialsProvider issue triggered by sst shell command #401

Closed alistairstead closed 1 month ago

alistairstead commented 1 month ago

When using set shell to run scripts/tests that use was-sdkV3 clients e.g. @aws-sdk/client-dynamodb I run into this already documented error from the sdk package https://github.com/aws/aws-sdk-js-v3/issues/2549

This appears to be being caused by the AWS_PROFILE value being passed through to the script from set shell. This has been validated to be the case with:

sst shell printenv

I assume that in SST V2 the AWS_PROFILE was not passed to the sub command of sst bind?

There is a user land work around as referenced in the thread above:

// https://github.com/aws/aws-sdk-js-v3/issues/2549
if (process.env.AWS_ACCESS_KEY_ID && process.env.AWS_PROFILE) {
  delete process.env.AWS_PROFILE
}

This resolves the issue but feels less than ideal.

jayair commented 1 month ago

Ugh they don't seem to doing anything about it in that issue.

alistairstead commented 1 month ago

Yeah, unlikely to get fixed in the SDK. I guess SST used to omit the profile value in the env?

alistairstead commented 1 month ago

I've created a PR that should resolve this: https://github.com/sst/ion/pull/458