I have my angular2 webapp hosted in s3. it has cloudfront as well. Its connecting to nodejs as backend which is in different machine in AWS EBS.
My web application works fine.But when i refresh any page , its throwing 404 Not Found with the below message.
Code: NoSuchKey
Message: The specified key does not exist.
Key: user/adduser/edit
RequestId: CA306FFABB30FB75
HostId: WAp7/BZMHH0UpE3z2dJLJT4gqEwv7u/LKbFTUuHH86lRyReLXvODLgTuTw+3emnTJ3jDj2VpiYo=
Can you help to resolve this?
NoSuchKey means it cannot find the topic. I should've created both the topic and bucket notification using same credentials. But when creating the topic, it allowed me to create without any credential and ended up being created under anonymous user. That is what has caused it to throw NoSuchKey error.
If the requested object was available in the S3 bucket for some time and you receive a 404 NoSuchKey error again, then check the following: Confirm that the request matches the object name exactly, including the capitalization of the object name. Requests for S3 objects are case sensitive.
Object invalidations typically take from 10 to 100 seconds to complete. You can check the status of an invalidation by viewing your distribution from the CloudFront console.
Open the CloudFront console. Choose Create Distribution. Under Origin, for Origin domain, choose your S3 bucket's REST API endpoint from the dropdown list. Or, enter your S3 bucket's website endpoint.
I am not sure if its the correct thing to do.But it fixed my issue. I configured s3 404 redirection url to be my index.html.ie pointed my 404 redirection to index.html itself. It worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With