AWS API Gateway messing up response: { "message": "Internal server error" }

Viewed 944

There's a lot of questions out there pertaining to "lambda" but I haven't touched that in my life, so it probably isn't relevant to this question.

All I've done so far is import a swagger json spec into AWS API Gateway and try my best to configure it to connect to my REST api.

My issue here is that when I try calling the API gateway endpoint through the test console, everything works as expected.

enter image description here

But then why I try querying the same endpoint from outside AWS like any end user, I get this nondescript 500 response.

enter image description here

The nifty thing is that since I own the backend service, I can see the logging, which clearly indicates that a successful 200 response was returned (which should be the json response shown in the first screenshot).

enter image description here

So now I know that it's AWS's fault that I'm getting a 500. But I'm honestly not sure what the issue could be.

Here are all relevant configuration screens for this particular endpoint.

Method Request

Method Request

Integration Request

enter image description here

Integration Response

enter image description here

Method Response

enter image description here

If there's any screen/setting I didn't provide that would be helpful, just let me know.

TLDR, api gateway endpoint works in online console ui, but not in real life

1 Answers

I follows @MarkB's advice and linked API Gateway to an IAM role with permissions to write to Cloudwatch and then here's the kicker: you have to redeploy the stage to jumpstart Cloudwatch (this is actually very poorly documented, aws).

And when I found out that I had to redeploy the gateway, that's when I also conveniently discovered that for any of the configuration changes I was making to be applied, I actually had to redeploy the entire thing.

So after redeploying, everything started to work.

Related