Getting a "The specified key does not exist" error even though the object is present in S3
See original GitHub issueHi,
I have just deployed v4.0 of this solution. After I upload an image to the source S3 bucket I get the following message, even though the object exists and is public (I can access it directly via an S3 URL):
{"status":500,"code":"NoSuchKey","message":"The specified key does not exist."}
Here’s an example:
- https://d3g99zcrnlow87.cloudfront.net/subfolder/4simon.jpg (500)
- https://image-handler-testing.s3.amazonaws.com/subfolder/4simon.jpg (200)
Oddly, when I upload an image to the root of the bucket, I can retrieve the image via the API/distribution without any issue:
- https://d3g99zcrnlow87.cloudfront.net/simoncoveney.jpg (200)
- https://image-handler-testing.s3.amazonaws.com/simoncoveney.jpg (200)
What’s weirder again is that if I then re-upload that second example to a sub-folder, after first uploading it to the root, it can be retrieved via the API/distribution:
- https://d3g99zcrnlow87.cloudfront.net/subfolder/simoncoveney.jpg
- https://image-handler-testing.s3.amazonaws.com/subfolder/simoncoveney.jpg
We can see here that the 500 response is not coming from CloudFront, but from the API (or something further along the process): https://wc9am3chn1.execute-api.us-east-1.amazonaws.com/image/subfolder/4simon.jpg
Can anyone give any insight into what’s going on?
Conor
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (1 by maintainers)
Top GitHub Comments
Implemented a fix for this as follows:
https://github.com/awslabs/serverless-image-handler/pull/130/files#diff-08e877f927a879fa2fe8faa4d6b1a1de
You may use the above for the specific issue you are facing, but if you’re willing to re-pack the node_modules of your function, you might use the PR where the fix above is a part of.
the PR is at -> https://github.com/awslabs/serverless-image-handler/pull/130
node_modules re-pack might be necessary because this PR will use a more recent version of Sharp.
The said PR contains several other fixes such as /fit-in/ behavior, strange “{}” return for images captured with samsung cams, improper resizing if ‘x’ is part of filename etc. Use at your own risk.
we also have same issue like this . we implemented aws-sdk in our angular application and we get the object file sometimes it gives error no specified key found even the key is proper . when i checked in the requested url we have %20 text instead of ’ ’ space . any solution to resolve this