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
S3 error : Unable to locate credentials #901
Comments
this sounds like a bug in aiohttp them not aiobotocore? |
thanks for report btw, we were just moving to aiohttp 3.8.1 |
I can't repro with this simple testcase on an EC2 machine w/ IAM role based auth: from aiobotocore.session import AioSession
import asyncio
loop = asyncio.get_event_loop()
session = AioSession()
client = loop.run_until_complete(session.create_client('s3').__aenter__())
loop.run_until_complete(client.list_objects(Bucket=BUCKET, Prefix=PREFIX)) |
I even tried running multiple auth tasks in parallel and couldn't repro |
I had the same error. Upgrading the
|
wait, this bug is stating the error happened when upgrading to 3.8.1, @blagojce95 you're saying the issue goes away after upgrading to 3.8.1? |
I am getting strange behaviour.
Also we have botocore in the project, and it works fine. I am getting this error only from aiobotocore. |
can you try with the latest release? there was a credentials refresh issue that was recently resolved |
I have tried it with the latest and tracked down the problem. For some reason the response for the instance metadata token at https://github.com/aio-libs/aiobotocore/blob/master/aiobotocore/utils.py#L102 imf = aiobotocore.credentials.AioInstanceMetadataFetcher(
**{'timeout': 1, 'num_attempts': 1, 'user_agent': 'Botocore/1.24.21 Python/3.10.4 Linux/5.4.0-1072-aws',
'config': {'ec2_metadata_service_endpoint': None, 'ec2_metadata_service_endpoint_mode': 'ipv4'}})
await imf._fetch_metadata_token() ends up being interpreted in a random charset, here: I'd suggest adding an Some relevant version numbers:
|
Here we go - debugging https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client_reqrep.py#L993
import charset_normalizer as chardet
chardet.detect(b'AC9ktV7QSFrt5lWEWUWX_Vh3Y_5CAL35q1ejpEfjygKn==') returns I've manipulated the token, so it is safe to publish. But it also showed me that the result depends on the token. Heisenbug through and through... |
actually need a more fundamental fix after reviewing code in botocore, will put out a PR shortly |
ok @achimgaedke started work here: #934 looks like a bunch more new async piping needed :( |
Since asynciohttp v3.8.1 was deployed on condaforge 3 days ago while trying to use s3fs with iamRole based credentials in AWS EC2 servers, we are encountering the following errors while opening files on s3 :
Fixing aiohttp in version v3.7.4.post0 solves this issue.
Checklist
pip check
passes without errorspip freeze
resultspip freeze results
Environment:
Additional context
I opened an issue with s3fs on this
fsspec/s3fs#558
The text was updated successfully, but these errors were encountered: