Error Sending PDF Files to S3 via API: Missing Access-Control-Allow-Origin Header Despite CORS Being Enabled

0

Hello, I would like to send png and pdf files through the API from my Bubble application via JS script to a bucket S3. I have added a role to IAM to which i granted GetObject and PutObject policies. I added a put request and enabled CORS, checking all the fields and saved it. I have added application/pdf and image/png to my Binary media types in API settings. Then I deployed the API, however I keep getting the following error that says that in the header of my PUT it says that I don't have Access-Control-Allow-Origin despite having it enabled in my Method Response of the PUT. When testing the API in Insomnia it shows status 200: OK.

JS code

I have attached a picture of the error.

1 Answer
1

Hi,

I'd suggest to follow the guidance of https://docs.aws.amazon.com/AmazonS3/latest/userguide/cors-troubleshooting.html to troubleshoot and fix.

This KB article will also be useful: https://repost.aws/knowledge-center/s3-configure-cors

Best,

Didier

profile pictureAWS
EXPERT
answered 4 months ago
profile picture
EXPERT
reviewed 4 months ago

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.

Guidelines for Answering Questions