Skip to content
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

application does not read profiles from config when credentials is missing #8

Open
Laurian opened this issue May 11, 2022 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@Laurian
Copy link

Laurian commented May 11, 2022

10:54:06.151 › [main.js] AWS Config file exists = true at path /Users/***/.aws/config
10:54:06.167 › Error: ENOENT: no such file or directory, open '/Users/***/.aws/credentials'

I had to create an empty .aws/credentials to have the app load the profiles defined in .aws/config

@serverlesspolska
Copy link
Contributor

serverlesspolska commented May 12, 2022

Hi @Laurian, thank you for submitting this bug.

Yes, application expects the presence of ~/.aws/credentials file.

Out of curiosity, why you didn't have that file?

@serverlesspolska serverlesspolska added the bug Something isn't working label May 12, 2022
@serverlesspolska serverlesspolska self-assigned this May 12, 2022
@Laurian
Copy link
Author

Laurian commented May 12, 2022

It kinda happened that way on a newly installed machine, just setup a single account with SSO and got only the config and not the credentials file

@serverlesspolska
Copy link
Contributor

I see that's really uncommon, but can happen that someone has only SSO configuration.

Thanks again for submitting it. I will fix it in the next release :-)

@serverlesspolska
Copy link
Contributor

Better error handling when there is no ~/.aws/credentials file has been added in version 1.15.3

@bwhaley
Copy link

bwhaley commented Dec 22, 2022

I see that this issue is still open so I'll just continue the conversation even though a release supposedly addressed the issue.

I'm using AWS SSO. I have it all set up and working on the CLI with many profiles. I use aws sso login --profile <my-profile> to log in, which opens a browser window from which I can allow the authentication and I'm off to the races.

At no point do I use a .aws/credentials file, nor would I want to as this will store credentials on disk. The aws sso login process adds credentials to AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

How can I make this set up work with CloudPouch?

@serverlesspolska
Copy link
Contributor

Hey @bwhaley I started working on this issue.

Indeed, right now CloudPouch expects ~/.aws/credentials and without it crashes.
image

As a temporary work-around solution you can add ~/.aws/credentials file with a FAKE credentials for default profiles

[default]
aws_access_key_id = FAKE
aws_secret_access_key = FAKE
cli_pager =

That will result in the error for this fake default profile obviously :-)
image
but you would be able to select other profiles which are defined in the ~/.aws/config.

Also, you don't need to execute the command aws sso login --profile <my-profile>. CloudPouch opens a web browser tab for you with an authentication message when you click on an SSO profile.
image

@bwhaley
Copy link

bwhaley commented Dec 24, 2022

This did the trick for me, thank you!

I do find that when I choose a profile, then select another, I'm asked to authenticate again. With SSO, I should only need to authenticate once. The same credentials should be valid for all the profiles.

@peteroruba
Copy link

Same here, using aws-vault to manage my credentials. Created a temporary [default] profile in ~/.aws/credentials file with AWS_REGION, AWS_DEFAUILT_REGION, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY variables, but still seeing the error that no credentials are found.

@serverlesspolska
Copy link
Contributor

Hey @peteroruba, thanks for trying out CloudPouch.

Have you defined it using lowercase?

As specified in the AWS docs for ~/.aws/credentials.

[default] 
aws_access_key_id = AKIAIOSFODNN7EXAMPLE 
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

@peteroruba
Copy link

@serverlesspolska thanks, that was it. For the record - I also had to add aws_session_token and now I am able to run it

@serverlesspolska
Copy link
Contributor

I'm glad it solved the problem for you 😃

Regarding the aws_session_token, I guess it's because your credentials are temporary, right?

@peteroruba
Copy link

Yes, exactly. I wanted to run it with my regular account for a quick evaluation, but for regular use a dedicated IAM user definitely makes more sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants