1

I'm trying to send GET/POST requests to an AWS API Gateway I setup. The lambdas/tests on AWS all work with the input/headers I'm trying to send, and return a 200 Status. I have enabled CORS on all the required resources, so when the browser sends the OPTIONS request, it returns the appropriate headers. It even works when I access the resource via CURL. But if I send the request from Chrome, I get a 500 response with these headers:

access-control-allow-headers: Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token
access-control-allow-methods: GET,OPTIONS,POST
access-control-allow-origin: *
content-length: 36
content-type: application/json
date: Sun, 20 Mar 2022 02:25:17 GMT
x-amz-apigw-id: PQuGLGw3oAMFXcw=
x-amzn-errortype: InternalServerErrorException
x-amzn-requestid: 4133f1b8-616a-464d-ae85-7f0fee8024ac

And this error is displayed in the console:

Access to XMLHttpRequest at has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

I enabled cloudwatch on the api, and that shows that the error is caused here:

Execution failed due to configuration error: Unable to transform request

No clue what that means, and it's failing on the "Options" request, which is a mock request automatically set up by AWS when I enabled CORS. It should have everything it needs, right?

Any idea what I'm doing wrong here? Thanks for your help.

Note: A similar question was asked, but was never resolved. There was one answer and it didn't work:

AWS API Gateway working through CURL but not working through javascript

1
  • I have the same issue.... and I also can't solve it. Did you end up fixing it? Commented May 28, 2022 at 7:04

1 Answer 1

1

Had the same issue, and I was able to solve it. Originally I had / in Binary Media Types, changing it to image/* and multipart/form-data got ride of the error.

enter image description here

Not sure if these other configurations will be useful for other people

Integration Response enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

I have no clue what my issue was to be honest. I ended up creating a new API via API Gateway and set everything up (I think) the same way and it worked. Very weird issue. Glad you found a different solution though!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.