You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there may be a bug with the SSO credentials library, or in its chain of dependencies. I'm raising the issue here as this is the SDK actually affected.
When using the fromSSO function, if I pass a home-relative path string toconfigFilepath, loading the credentials from ambient INI files fails. For example ~/.aws.config as opposed to /Users/jbreckmckye/.aws/config
If I pass a root-relative path to the same file, or omit the configFilepath, it works fine and picks up the credentials from the ini.
Expected Behavior
Expected: to retrieve the credentials already set up with aws sso login --profile MyProfileName, by using the files populated already in ~/.aws/credentials, ~/.aws/config
Current Behavior
The SDK throws a CredentialsProviderError due to, it seems, being unable to load un-path-resolved files
Reproduction Steps
import{fromSSO}from'@aws-sdk/credential-providers'import{S3Client,ListBucketsCommand}from'@aws-sdk/client-s3'asyncfunctionmain(){constclient=newS3Client({region: 'eu-west-1',credentials: fromSSO({profile: 'EngineerBeta',filepath: '~/.aws/credentials',configFilepath: '~/.aws/config',// works IF this is omitted, OR is the `realpath` of this same file}),}asany)constcmd=newListBucketsCommand({})awaitclient.send(cmdasany)}
Thanks for reaching out and the in-depth repro steps. I agree that since the distinction about home relative or root relative path was never mentioned in our docs, this should be marked as a bug.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Describe the bug
I think there may be a bug with the SSO credentials library, or in its chain of dependencies. I'm raising the issue here as this is the SDK actually affected.
When using the
fromSSO
function, if I pass a home-relative path string toconfigFilepath
, loading the credentials from ambient INI files fails. For example~/.aws.config
as opposed to/Users/jbreckmckye/.aws/config
If I pass a root-relative path to the same file, or omit the
configFilepath
, it works fine and picks up the credentials from theini
.Expected Behavior
Expected: to retrieve the credentials already set up with
aws sso login --profile MyProfileName
, by using the files populated already in~/.aws/credentials, ~/.aws/config
Current Behavior
The SDK throws a
CredentialsProviderError
due to, it seems, being unable to load un-path-resolved filesReproduction Steps
The
ENV_CONFIG_PATH
env var is unset.I was able to trace the code as far as Smithy's
loadSharedConfigFiles
function:configFile
andcredentialsFile
are resolved to their root-relative paths in the 'good' cases~/.aws/...
home-relative paths specifically whenconfigFilepath
is a home-relative pathPossible Solution
I wasn't able to trace the logic further than the
shared-ini-file-loader
package in the Smithy namespace.Additional Information/Context
No response
SDK version used
@aws-sdk/credential-providers version 3.509.0
Environment details (OS name and version, etc.)
MacOS Sonoma
The text was updated successfully, but these errors were encountered: