Android Amazon S3 exception: “The specified key does not exist”

匿名 (未验证) 提交于 2019-12-03 00:46:02

问题:

I am using the AmazonS3Client in an Android app using a getObject request to download an image from my Amazon S3 bucket.

Currently, I am getting this exception:

com.amazonaws.services.s3.model.AmazonS3Exception:  The specified key does not exist.  (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; 

Even though I am able to see the object with the specified key in my S3 bucket.

回答1:



回答2:

For me, the object definitely existed and was uploaded correctly, however, its s3 url still threw the same error:

<Code>NoSuchKey</Code> <Message>The specified key does not exist.</Message> 

I found out that the reason was because my filename contained a # symbol, and I guess certain characters or symbols will also cause this error.

Removing this character and generating the new s3 url resolved my issue.



回答3:

In my case the error was appearing because I had uploaded the whole folder, containing the website files, into the container.

I solved it by moving all the files outside the folder, right into the container.



回答4:

The reason for the issue is wrong or typo in the Bucket/Key name. Do check if the bucket or key name you are providing does exists.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!