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.

Some tests fail if there are no AWS credentials

See original GitHub issue

Describe the bug

Several tests fail with botocore.exceptions.ConnectTimeoutError: Connect timeout on endpoint URL: "http://169.254.169.254/latest/api/token" if I don’t provide AWS credentials. Specifically, with environment variable AWS_CONFIG_FILE=/dev/null some tests fail, and AWS_CONFIG_FILE=/my/aws/config makes all tests pass.

On tag 2.2.0, only test_can_delete_urlencoded_object fails, regardless of the value of $AWS_CONFIG_FILE. That test is known to be broken (https://github.com/aio-libs/aiobotocore/commit/643d041fcebb3f3867950bfb689493d394995246).

Here is the complete log, including commands to reproduce and outputs: log.txt

Checklist

  • I have reproduced in environment where pip check passes without errors - pipenv check reports some warnings about security issues in out-dated packages.
  • I have provided pip freeze results - I include results from pipenv graph instead
  • I have provided sample code or detailed way to reproduce
  • I have tried the same code in botocore to ensure this is an aiobotocore specific issue
  • I have tried similar code in aiohttp to ensure this is is an aiobotocore specific issue
  • I have checked the latest and older versions of aiobotocore/aiohttp/python to see if this is a regression / injection

pip freeze results I included results from pipenv graph in the attached log

Environment:

  • Python Version: 3.10
  • OS name and version: Arch Linux up-to-date

Additional context I’m trying to upgrade the Arch Linux package python-aiobotocore. For version 2.2.0 all tests pass with the latest moto, while tests fail with similar botocore.exceptions.ConnectTimeoutError exceptions for newer versions. How dependencies are installed and tests are run are quite different from steps listed here, while I don’t think that makes a difference.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
tomagcommented, Jul 20, 2022

If you’re running localstack (or any of the kind) and don’t want your tests to try and get credentials from AWS, try -

  1. set the environment variable AWS_EC2_METADATA_DISABLED = true
  2. aws_secret_access_key=test, aws_access_key_id=test (or anything else)
1reaction
thehesiodcommented, Jun 28, 2022

thanks, will look when I get a chance, but also open to PRs 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
AWS tests fail when no credentials are present #1136 - GitHub
Most of our AWS tests that use the DefaultCredentialProvider from rusoto will panic and fail the tests if no form of credentials is...
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 >
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 >
Unit tests fails with IllegalArgumentException due to aws ...
Configuring region: Like for the credentials, the Spring Cloud AWS module also supports the configuration of the region inside the Spring ...
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