-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Not loading creds from Shared Credentials File #2289
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
Comments
Hello @jaisrael1 Thanks for reporting this issue. Is AWS_PROFILE being properly loaded in the nodejs script? To make sure I'm understanding this fully, which command is giving you these paths? \Users\Jake\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\jaisrael.aws\config |
All 3 environment variables are being properly loaded in the script. When I type 'aws configure list' in cmd, it prints: Name Value Type Location So that path is the location of the config file that the region is being loaded from. It is stored in the AWS_CONFIG_FILE environment variable. I found a workaround, I can manually set 'AWS.config.credentials = new AWS.SharedIniFileCredentials({ filename: process.env.AWS_SHARED_CREDENTIALS_FILE});' As long as I put 'const S3 = new AWS.S3()' after the above line, everything works. So because I can load the creds from the shared credentials file manually and everything appears to work, it looks like it's just not doing this automatically. |
Have you set AWS_SDK_LOAD_CONFIG? That needs to be set for the shared credentials file to be loaded. See this PR for details: #1391 (comment) with additional context here: #2197 (comment) |
That fixed the problem, many thanks! |
You're welcome! Closing this issue. |
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. |
I am using Windows 10 and Windows Subsystem for Linux (WSL). In order to keep my AWS credentials centralized, I have the AWS_CONFIG_FILE and AWS_SHARED_CREDENTIALS_FILE environment variables in Windows set to the location of ~/.aws/config and ~/.aws/credentials in the Linux file system. I have also set AWS_PROFILE to the profile I would like to use.
When I run 'aws configure list' from cmd, it retrieves them just as I would expect. It gives the same output as when I run the command in the Linux subsystem except that the location of config-file is
\Users\Jake\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\jaisrael.aws\config
Rather than
~/.aws/config
The keys it gets are correct. When I check AWS.config.credentials from within a nodejs script however, it comes up as 'null'. I expected it to load credentials from the config and credentials files just as the CLI does.
The text was updated successfully, but these errors were encountered: