简体   繁体   中英

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

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.

在此处输入图像描述

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

在此处输入图像描述

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).

在此处输入图像描述

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

方法请求

Integration Request

在此处输入图像描述

Integration Response

在此处输入图像描述

Method Response

在此处输入图像描述

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM