Skip to content

Error accessing AWS.SharedIniFileCredentials when credentials file does not exist #2771

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

Closed
3 tasks done
awschristou opened this issue Jul 11, 2019 · 2 comments
Closed
3 tasks done
Labels
guidance Question that needs advice or information.

Comments

@awschristou
Copy link

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
If you have a config file and no credentials file, you get an ENOENT error against the credentials file when attempting to load a shared credential.

Is the issue in the browser/Node.js?
Node.js

If on Node.js, are you running this on AWS Lambda?
No

Details of the browser/Node.js version
Paste output of npx envinfo --browsers or node -v
v10.15.1

SDK version number

  • For Node.js, get SDK version by

To Reproduce (observed behavior)
Steps to reproduce the behavior (please share code or minimal repo)

  • Set up shared credentials
    • Set up a valid config file
    • Have no credentials file
  • Try to access a profile with the SDK
    • from a typescript file, I have
new AWS.SharedIniFileCredentials({profile: profileName})
  • Error occurs

Expected behavior
SDK handles this without error.

@awschristou awschristou added the bug This issue is a bug. label Jul 11, 2019
@AllanZhengYP AllanZhengYP added guidance Question that needs advice or information. and removed bug This issue is a bug. labels Jul 12, 2019
@AllanZhengYP
Copy link
Contributor

Hey @awschristou,

This is intentional. You need to set AWS_SDK_LOAD_CONFIG environmental variable to be able to load credentials from config file. This is due to some backwards compatibility concern, see #1391 for more information.

If you don't set it, SDK will assume there is no config file when loading the credentials. That's why you see credentials loading failed.

@lock
Copy link

lock bot commented Nov 28, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

3 participants