Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
How to list objects in a bucket ? NoSuchKey error
I build a s3 space and can upload files in this one with success. I meet a problem when I try to browse files stored on my space.
Here is the client I use :
session = boto3.session.Session() client = session.client('s3', region_name='fra1', endpoint_url=settings.AWS_S3_ENDPOINT_URL, aws_access_key_id=settings.AWS_ACCESS_KEY_ID, aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY )
This part is ok because it’s exactly the same for uploading.
Error happens at the following line :
resp = client.list_objects(Bucket=settings.AWS_STORAGE_BUCKET_NAME)
I got this response :
An error occurred (NoSuchKey) when calling the ListObjects operation: Unknown
And I can’t explain why it doesn’t recognize my key. I tried with a wrong key like Bucket=“helloworld” and got exactly the same error.
Otherwise I’m sure my settings.AWSSTORAGEBUCKETNAME is the correct one because I can seet it when I go on my endpointurl
Thank you for helping :)
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×