Fail to enable CORS for API Gateway functions

0 votes

I get

enter image description here

While attempting to enable CORS on API Gateway, why is that and how do I resolve this? These functions are deployed using AWS SAM. But I notice if I create my own APIs via AWS Console this happens too

The errors looks like:

  • invalid model name specified application/json=Empty
  • invalid response status code specified

I found I seem to need to add an "Empty" response model myself?


Now, I get

Add Access-Control-Allow-Origin Integration Response Header Mapping to POST method (invalid response status code specified)

How do I resolve this?

Oct 9, 2018 in AWS by eatcodesleeprepeat
• 4,710 points
8,873 views
Hi. Did you get the answer for 'Add Access-Control-Allow-Origin Integration Response Header Mapping to POST method (invalid response status code specified)'? If so, can you share it with me?

Thanks.
You can see the below-given answer.

1 answer to this question.

0 votes

Firstly please select your root resource and select "Enable CORS". It will enable CORS to all methods. Ideally it should work. If in case it doesn't work Please add an empty json in the response as I have marked in the screenshot attached. I believe you don't have any default response header added in your OPTIONS method response (in Method Response ). Please refer screenshot

enter image description here

answered Oct 9, 2018 by Priyaj
• 58,090 points

Related Questions In AWS

0 votes
1 answer

How to Enable CORS for an AWS API Gateway Resource

Since you're using Lambda Proxy integration for ...READ MORE

answered Jul 10, 2018 in AWS by Hammer
• 360 points
3,741 views
0 votes
1 answer
0 votes
2 answers
+1 vote
3 answers

Not able to pass params POST to AWS Lambda from Amazon API Gateway

For this template : application/x-www-form-urlencoded  This line below will ...READ MORE

answered Jun 13, 2018 in AWS by Cloud gunner
• 4,670 points
8,322 views
0 votes
1 answer

CORS in AWS API Gateway + AWS Lambda

You could try downloading the AWS APIG ...READ MORE

answered Oct 9, 2018 in AWS by Priyaj
• 58,090 points
3,796 views
0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP