question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting a "The specified key does not exist" error even though the object is present in S3

See original GitHub issue

Hi,

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:

Oddly, when I upload an image to the root of the bucket, I can retrieve the image via the API/distribution without any issue:

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:

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:closed
  • Created 4 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rpongcommented, Jul 27, 2019

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.

0reactions
Himanshu824commented, Jun 15, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon S3 exception: "The specified key does not exist"
Well this error is actually rather straight forward. it simply means that your file does not exist up within the S3 bucket.
Read more >
Amazon S3 exception: "The specified key does not exist"
it simply means that your file does not exist up within the S3 bucket. Several things could be wrong: You could be trying...
Read more >
Troubleshoot the 404 NoSuchKey error from Amazon S3
My users are trying to access objects in my Amazon Simple Storage Service (Amazon S3) bucket. However, Amazon S3 is returning the 404...
Read more >
NoSuchKey: The specified key does not exist. - YouTube
aws #sam # s3 #lambdamessage: 'The specified key does not exist.', code: 'NoSuchKey', ERROR Invoke Error {"errorType":"NoSuchKey" ...
Read more >
The specified key does not exist : aws S3 giving me ... - YouTube
An error occurred (NoSuchKey) when calling the GetObject operation: The specified key does not exist. S3 giving me NoSuchKey error even when ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found