All Questions

Content language: English

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

CORs Error from s3 Static pages

We are serving React Javascript static pages from an s3 bucket. The bucket has set CORs permissions to allow for api calls to two different api-gateway HTTP endpoints. ``` [ { "AllowedHeaders": [ "api-key" ], "AllowedMethods": [ "GET", "POST", "PUT", "DELETE", "HEAD" ], "AllowedOrigins": [ "http://*", "", "" ], "ExposeHeaders": [ "Access-Control-Allow-Origin" ] } ] ``` In the HTTP API We have CORs enabled: ![Enter image description here](/media/postImages/original/IM_EcnFa_WSU63Bwu_k6zU7w) I can run the API and frontend locally - make the call the HTTP API to upload the file and it works, but when the files are hosted in s3 we get the error. ![Enter image description here](/media/postImages/original/IMl4CGJszJT52n54Ys-_cgxQ) THe call isn't even making it to the lambda function because its not getting logged in Cloudwatch, and the only information getting logged to Cloudwatch from the HTTP API is a 500 error but no reason is given. I do have an `OPTIONS` method specified on this specific endpoint with a lambda integration. ![Enter image description here](/media/postImages/original/IMA22Ya2uGS-6-2COkQUODhg) And this stage (`test`) is set up for autodeployments. Even though its not reaching the lamda - we are handling the options request there: ``` try { if (event.routeKey.includes('OPTIONS')) { return { statusCode: 200, headers: { "Access-Control-Allow-Headers" : "*", "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "OPTIONS,POST" } }; } ``` I must be overlooking something. TIA
asked 4 hours ago