I am getting below response when I hit AWS API gateway.
502: Bad Gateway
{
"message": "Internal server error"
}
I know that API gateway request payload limit is 10MB and I haven't exceeded that, but response size might be beyond 10 MB. Can response size affect?
Could find nothing in CloudWatch, not even getting logs related to this invocation.
Tried to follow this, but could find nothing.
First, Try to test your lambda function by invoking it in the api gateway Console or in the test part in the lambda console.
If the lambda function works, then maybe its a problem related to the parameters, content ( Integration request / response) or the permissions of the API Gateway + lambda.
Check also the time out of the lambda /!\
Related
I am trying to use AWS Lambda function with API gateway endpoint as weebhoks. The problem is that after a few requests I get 500 (or sometimes 503) errors. In Cloudwatch I can see that the request does not even trigger Lambda. So API gateway throws the errors. If I am waiting a short time then it everyhting is working fine again.
In Cloudwatch of API gateway I can only see the error status, no more.
I have an API Gateway, integrated to a Step Function, inside a VPC.
When I hit the endpoint the step function is successfully executing, but it's still replying with:
500 Internal Server Error
{
"message": "Internal server error"
}
Everything is setup in terraform, have tried setting up a response in terraform and on the console but both aren't working.
screenshot: https://pasteboard.co/Kikasjb.png
note, looked at this post: AWS API Gateway - Lambda - Internal Server Error
It's similar but there the reply is around a lambda returning a value, but this step function is asynchronous so not sure how something gets send back here. Thanks!
I discovered my issue was that when settings in the API Gateway in the console I have to redeploy the API gateway before being able to test the change.
I'm new to AWS and Node so I really appreciate everyone's suggestion on this one. Recently in my system, something strange happened. Sometimes (~20 times/ month), a lambda request got timeout. It's just a simple request in middleware for authentication (I'm using node.JS serverless). The issues is I cannot trace this request from API gateway. Sorry I'm suck at explaining things so I'm gonna put it like this:
My system's flow: CloudFront -> API Gateway -> Lambda -> RDS
Normally if I want to trace a request:
I get the requestID from Lambda's Log
And search it in the API Gateway's Log:
But for these Timeout request:
I cannot find anything at all in API Gateway's Log:
Like it appeared out of nowhere... Please help and thanks for the suggestion.
You may already be aware but API Gateway has a hard max timeout limit of 29 seconds and stops waiting for the integration to respond after that time.
The Request ID that you are pulling from the lambda logs is the lambda request ID. This is a bit of speculation but I'm guessing since the Lambda took longer than 29 seconds and never returned to API Gateway since API Gateway timed out and stopped waiting, the API Gateway never received a response from the Lambda function to know what the lambda request ID is.
There still should be some API Gateway logs for this invocation but it won't contain any of the normal integration response log lines because it never received a response from the lambda integration.
Perhaps try searching for 504 in the API Gateway logs since this is the response code when the gateway times out.
Or as AADProgramming recommends, the X Ray service was designed to help users track requests across many services so enabling that would be helpful here.
I want to submit a GET request using Authorization and Content-Type(application/json) as headers. Authorization would contain "Bearer " + token.
I am using Lambda function as to trigger when user hits this API endpoint. As this is get request, I am sending body = undefined in parameters.
But since 4-5 hours I am getting "internal server error" as of status code =502.
I noticed that these requests are due to bad gateway, still they are captured in cloudwatch logs.
The thing is, I want to know how to setup a GET request in AWS API gateway as I have not much experience in this technology.
I am currently using AWS API Gateway in combination with a lambda invocation. This is working perfectly, as long as I stay withing the known AWS Lambda Limits. One of the calls receives a file via a POST request, so that goes fine as long as the file is < 6 MB.
However when the file is too large, I get a 502 Bad Gateway response. This is not really helpful to the client, I would rather return a 413 Payload Too Large. How can I do this? I haven't found a way so far, looking at the API Gateway options.