Skip to content

S3 Key Not Found after receiving SQS message from S3 event notification

0

I've configured an S3 bucket for private access and set up an event notification to trigger an SQS message upon object uploads (PUT method). While I'm successfully receiving SQS notifications, I'm encountering a 'KeyNotFound' exception when attempting to retrieve metadata for large objects using HeadObject Request.

I've implemented a 60-second delay on the SQS queue but no luck.

I'm seeking guidance on potential causes for this behavior and effective solutions to resolve the 'KeyNotFound' exception.

Note: I have setup a cloudfront distribution on the bucket.

2 Answers
3
Accepted Answer

Hi,

No guarantee but I have seen such error "KeyNotFound" when the key was containing special characters.

See the various lists of such chars on https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html to compare the name of your object.

If it contains such chars, try to avoid them.

Best,

Didier

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
  • Verified. that was the issue. Appreciate the help.

  • Glad that it solved your issue. Thanks for accepting my answer!

2

Hello.

Can you check inside the S3 bucket from the management console and confirm that there is actually an object in that key?
Also, is it possible that the key is specified incorrectly when executing the HeadObject request?

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
  • Yes, the object exists in that key. No, it works if the object size is few KB's.

  • At what file size does the problem occur? I would like to reproduce the problem in my environment. It would be helpful if you could also share the code you are using.

  • Thanks for helping out. It turns out to be the special cases was the root cause. Not sure how the objects were exists in the path but still the HeadObject was failing. It's totally tricked me. Once again appreciate your help.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.