-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
boto3.client.get_object is prepending the bucket name to the file key #3654
Comments
The same issue occurs with |
Hi @antoinebrtd, thanks for reaching out. Could you provide debug logs of a run where this behavior occurs? You can get debug logs by adding boto3.set_stream_logger('') to the top of your script, and redacting any sensitive information. Thanks! |
^ Removed the access keys and signature is a fake random string |
Changing the dependencies from
to
and removing the I would expect |
Can you go into more detail about why you are specifying an endpoint_url? If endpoint_url is left empty, Boto3 will always connect to AWS, which it looks like you are trying to do. Overriding that variable is only necessary if you are using non-AWS S3 storage. |
For anyone having this issue, commenting out the |
Describe the bug
I recently updated boto3 to the latest version and I am trying to access a file using
boto3.client.get_object
from my backend.I uploaded a file from S3 console at the "root" of the bucket, so I am sure
myfile.png
exists with the specified key. When I try to download it using the code below, it looks like it is incorrectly prepending the bucket name to the file path, so it can't find the file. I keep getting 404 errors:Expected Behavior
I would expect the object to be found correctly. It was working before updating boto3.
Current Behavior
I have to move
myfile.png
from the root of the bucket to a folder with the same name as the bucket for boto3 to find the file. So this:is actually resolving the path to
my-bucket/myfile.png
insidemy-bucket
bucketReproduction Steps
Create a bucket in eu-west-3 region from s3 console and an access point alias to that bucket, and upload a file at the root of the bucket. Create access keys in iam with read access. Run the following code. From s3 console create a folder in the bucket with the same name as the bucket and move the file in it, run the code again
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.26.94
Environment details (OS name and version, etc.)
Linux server
The text was updated successfully, but these errors were encountered: