question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

detect-aws-credentials fails when no credentials are set

See original GitHub issue

As part of our developer setup, each person installs the pre-commit and inherits the project’s hooks, but not everyone has aws credentials set up, so detect-aws-credentials will product a failure when the individual hasn’t set any keys file or has any exported to their env.

https://github.com/pre-commit/pre-commit-hooks/blob/20f04626a1ee7eb34955d775a37aa9a56a0a7448/pre_commit_hooks/detect_aws_credentials.py#L112

I’m not sure of the best way to handle this within the current logic - I’d rather exit 0 with a passing warning than fail, since this then forces the individual to go and set up a credentials file, even if they don’t use one.

I guess the “simple” workaround is to export AWS_SECRET_ACCESS_KEY="RANDOMSTRINGTHATNEVERTEXISTSINMYCODE!!" before running the pre-commit hooks, but this seems wrong.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, May 31, 2021

it can, that’s what --allow-missing-credentials is for

the reason it does not do that by default, is you may not have your credentials configured properly and therefore it can’t protect you against mistakes

1reaction
Dunedancommented, Feb 10, 2017

Failing when no credentials are configured has been the behavior since the very first version of this hook. An obvious solution would be of course to simple remove the following lines: https://github.com/pre-commit/pre-commit-hooks/blob/master/pre_commit_hooks/detect_aws_credentials.py#L114-L120

I agree that removing those lines would allow silent failures in cases where a user with credentials in some obscure location installs the hook and expects it to work without having tested it.

My proposal to solve this problem is to simply introduce an additional argument for the script, providing the ability to simply disable failures when no credentials are found, but keeping the current behavior the default.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve "Unable to locate credentials" error in ... - Amazon AWS
An "Unable to locate credentials" error indicates that Amazon S3 can't find the credentials to authenticate AWS API calls.
Read more >
Resolve "Unable to locate credentials" error in Amazon S3
An "Unable to locate credentials" error indicates that Amazon S3 can't find the credentials to authenticate AWS API calls. To resolve this issue, ......
Read more >
1 - Stack Overflow
It seems a simple task, but somehow it fails: AWS client does not see the credentials specified in ~/.aws/credentials .
Read more >
How do I fix the error "Unable to locate credentials ... - YouTube
How do I fix the error " Unable to locate credentials " when I connect to my S3 bucket with AWS CLI?
Read more >
AWS DynamoDB CredentialsError: Missing credentials in config
Missing credentials in the config, if using AWS_CONFIG_FILE, set ... something is wrong with your AWS Credentials and this is not DynamoDB specific...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found