Richael
Richael

Reputation: 405

Boto AWS S3- "NoSuchKey", when the Key does indeed exist

I have a function to read the contents of an AWS S3 'key'. The key is a JS file called colorInfo. I can navigate to the file from the S3 interface and I can access it successfully from the python shell. Upon recreating the python shell steps within a function and inserting the function into the rest of the python file, it renders me an error from within the Django debug console when called--

'S3ResponseError: 404 Not Found' and: '<Error><Code>NoSuchKey</Code><Message>The specified key does not exist</Message<Key>http:/s3.amazonaws.com/org.gomoto.izmo/Colors/2014/
14ram/14ram1500tradesmanreg4a/colorInfo.js</Key>'

the 'colorInfo.js' lives within the '14ram1500tradesmanreg4a' key. Does anyone have any insight? I can provide more details if it may help anyone.

Thanks!

Upvotes: 2

Views: 4775

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 179054

The error message is correct. The object you requested does not exist, because you are requesting the wrong object. Read it carefully:

<Key>http:/s3.amazonaws.com/org.gomoto.izmo/Colors/2014/ 14ram/14ram1500tradesmanreg4a/colorInfo.js</Key>

That's the key, which only contains the path and filename. It does not contain the bucket, or "http" or the hostname.

This means that instead of trying to download http://s3.amazonaws.com/bucket/object you appear to be linking to http://s3.amazonaws.com/bucket/http:/s3.amazonaws.com/bucket/object. It looks as if, at some point, you are providing a full URL, where you should be providing only the key.

Upvotes: 3

Related Questions