-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Getting CredentialsError: Missing credentials in config starting in v2.44.0 #1483
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
@matsaleh13 Can you verify in your node.js script if The |
Thanks for the fast reply @chrisradek! I added console output for the two bits of information. (FWIW I used util.inspect() instead of JSON.stringify() because IMO it's easier to read).
Here's the top-level originalError property, with another one nested: originalError:
{ message: 'Could not load credentials from any providers',
code: 'CredentialsError',
time: 2017-04-25T21:05:42.013Z,
retryable: true,
originalError:
{ message: 'Connection timed out after 1000ms',
code: 'TimeoutError',
time: 2017-04-25T21:05:42.013Z,
retryable: true } } } Here's the full output for completeness: λ node aws\loadtestctl.js status
Getting status of LoadTester ECS tasks.
AWS_SDK_LOAD_CONFIG = undefined
Error from listTasks(): { CredentialsError: Missing credentials in config
at ClientRequest.<anonymous> (C:\Dev\GitHub\vcme\cq-loadtest\node_modules\aws-sdk\lib\http\node.js:83:34)
at ClientRequest.g (events.js:291:16)
at emitNone (events.js:86:13)
at ClientRequest.emit (events.js:185:7)
at Socket.emitTimeout (_http_client.js:620:10)
at Socket.g (events.js:291:16)
at emitNone (events.js:86:13)
at Socket.emit (events.js:185:7)
at Socket._onTimeout (net.js:339:8)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
message: 'Missing credentials in config',
code: 'CredentialsError',
time: 2017-04-25T21:05:42.014Z,
retryable: true,
originalError:
{ message: 'Could not load credentials from any providers',
code: 'CredentialsError',
time: 2017-04-25T21:05:42.013Z,
retryable: true,
originalError:
{ message: 'Connection timed out after 1000ms',
code: 'TimeoutError',
time: 2017-04-25T21:05:42.013Z,
retryable: true } } } Hope this helps, and thanks! |
@matsaleh13 If you log |
OK, tried the above, but logging Attempted to log what appears to be related properties:
Seems like it can't load from any provider because it has none. Other info:
Hope this helps. |
Can you share what your credentials look like in the version of the SDK that does work?
What I'm trying to get at, is what |
I just realized I neglected to mention that I'm running all this on Windows 10. Sorry for that. Also, I have a HOME env var set that maps to From git bash, the $HOME folder resolves to Also, from git bash, the Now, to answer your questions above: Logging AWS.config.credentials.constructor: function SharedIniFileCredentials(options) {
AWS.Credentials.call(this);
options = options || {};
this.filename = options.filename;
this.profile = options.profile || process.env.AWS_PROFILE || 'default';
this.disableAssumeRole = !!options.disableAssumeRole;
this.get(function() {});
} In my $HOME folder I do have an [Matthew Walker Orig@pearl:~]
$ ls -la ~/.aws
total 10K
drwxr-xr-x 1 Matthew Walker Orig 197609 0 Nov 30 11:13 ./
drwxr-xr-x 1 Matthew Walker Orig 197609 0 Apr 9 11:44 ../
-rw-r--r-- 1 Matthew Walker Orig 197609 46 Nov 30 11:16 config
-rw-r--r-- 1 Matthew Walker Orig 197609 119 Nov 30 11:13 credentials The contents of
The contents of
|
@matsaleh13 I have a Windows 10 machine I can test with, that at least gives me something to look into! I should have asked before, which version of node.js are you using as well? Thanks for your patience and detailed notes so far! |
No, I'm not using the aws-cli through git-bash, and I don't run my node.js tool from there either. I mainly use git-bash to get better UX for navigating the file system and to access the necessary unixy tools ;). I have only tried Win10 bash (bash on Ubuntu on Windows) as an experiment. I don't use it for anything useful because last I heard you can't exec windows programs using it, and all my work is still Windows-based. Node: λ node -v
v6.9.1 aws-cli (in case...): λ aws --version
aws-cli/1.11.80 Python/2.7.9 Windows/8 botocore/1.5.43 Thank you for your prompt responses and guidance! Happy to team with you on this. Sorry I have such an awkward, hybridy environment! Um.. okay actually I'm not. I take pride in my ability to generate edge cases with simply a blink. :) Cheers! |
@matsaleh13 Dug through source code and figured out the issue. Based on your configuration, you need to set Prior to 2.44.0, the This isn't an edge case tbh, anybody who uses 2.44.0 will be hitting this issue. You are just early to the party :) |
Hi @clark-pan, The default file path for @matsaleh13 As of 2.44.0, the SDK is using
(@chrisradek This would not affect users running node on the Windows subsystem for Linux, as they would be running a copy of node compiled on Ubuntu that uses the *nix implementation of |
@clark-pan and @jeskew thanks for digging into this. I set the environment vars mentioned above in the windows shell using: set AWS_SDK_LOAD_CONFIG=1
set AWS_SHARED_CREDENTIALS_FILE=%HOME%/.aws/credentials
set AWS_CONFIG_FILE=%HOME%/.aws/config (Apologies to all for the bastardized blending of OS shell conventions.) After that, my node.js program worked; the CredentialError no longer occurs! So, I guess the current However, because of that nonstandard setup, the change in v2.44.0 to use I guess deciding how to support $HOME on windows is kind of a crap shoot. Although, it might be reasonable to assume that, if present, $HOME would have been added explicitly and should take precedence. I'd bet that whichever way you go will cause problems for someone though. Might be useful to present the user a message from Also might be good to add a note about it to the docs, but they're so deep already that it's likely to be missed by the reader. :( FWIW, while troubleshooting this I did reinstall awscli to At any rate, thanks for the info and guidance in this! Cheers. |
@matsaleh13 The CLI uses boto (the AWS SDK for Python) under the hood, and it looks like Python's #1484 changes the precedence of how home directories are located so that |
For me the issue was I put |
For those unfortunate souls that might find themselves in this same predicament, here is what I discovered. I had my credentials in the right spot Turns out, the SharedIniFileCredentials loader will pick the stanza from the credentials file whose name matches the So, if your
|
@mscottx88 when i deploy to beanstalk (my react node js app) login works as intended, but after a few hours I get "missing credentials in config" any idea why that may be? |
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 use the aws-sdk from a little node.js CLI tool that I wrote for running some EC2 tasks. This has been working for several weeks with no problem. Then, I recently upgraded the version of the aws-sdk from 2.9.0 to 2.45.0. After that I started getting the error whenever my tool made a call to the aws-sdk.:
I downgraded my aws-sdk version to 2.44.0, and the error still occurs in that version.
I downgraded again to 2.43.0, and the error no longer occurs.
So, it seems that whatever is causing this to happen is a change introduced in [email protected].
Here is an example of the code in my tool where the problem occurs:
I checked out he CHANGELOG for 2.44.0, and I did see a mention of a change related to the AWS_SHARED_CREDENTIALS_FILE. I'm not sure that's directly relevant though.
I can say that this tool always runs using the default credentials specified via the awscli, i.e. set via
aws configure
.Not sure at this point whether this is an actual bug in aws-sdk, or in my code that was somehow revealed by the change to aws-sdk.
I'm a n00b to aws-sdk, so any suggestions or guidance is welcome.
Thanks and cheers, Matt
The text was updated successfully, but these errors were encountered: