ruimarinho / gsts

Obtain and store AWS STS credentials to interact with Amazon services by authenticating via G Suite SAML.
MIT License
212 stars 37 forks source link

Profile not found in credentials file #87

Closed shanee-spring closed 11 months ago

shanee-spring commented 1 year ago

I followed the directions in the readme to set up credentials for a profile called "sts" and I recieve the following error:

$ aws sts get-caller-identity

Error when retrieving credentials from custom-process: 2023-03-17T18:13:11.680Z ERROR gsts: ProfileNotFoundError: Profile "sts" not found in credentials file
    at CredentialsManager.loadCredentials (file:///usr/local/Cellar/gsts/5.0.0/libexec/lib/node_modules/gsts/credentials-manager.js:164:13)
    at async file:///usr/local/Cellar/gsts/5.0.0/libexec/lib/node_modules/gsts/index.js:108:21 {
  profile: 'sts'
}

Version

$ gsts --version
5.0.0

I just updated to the new version, I've been using a previous version of the gsts tool with multiple AWS profiles with no problems.

It looks like after logging in, there are no credentials in the ~/.aws/credentials file.

shanee-spring commented 1 year ago

I was able to add the --no-credentials-cache to get the credentials to populate in the aws credentials file. But I still don't know why following the example in the README doesn't work.

rehanhwr commented 1 year ago

the default cache dir is not ~/.aws/, it actually depends on your machine because it uses path.cache from env-paths. take a look at the default value here: https://github.com/ruimarinho/gsts/blob/a96dc8789c2fae65175f8ad01f37ca879c9e4518/parameters.js#L22-L25

while paths itself is from env-paths https://github.com/ruimarinho/gsts/blob/a96dc8789c2fae65175f8ad01f37ca879c9e4518/index.js#L24 https://github.com/ruimarinho/gsts/blob/a96dc8789c2fae65175f8ad01f37ca879c9e4518/index.js#L17

this error is actually related to this #84 , I suspect it's because there's major changes in the v5.0.0 implementation. I've submitted PR to solve this issue here