500 error when using AWS API gateway as webhook - amazon-web-services

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.

Related

How to fix the 504 error in API Gateway on AWS?

I'm using API Gateway to create a REST API where I can run my API which is hosted via docker and jenkins, setup on aws ec2.
But whenever I try to send the request through API Gateway, I get the error of 504
The error message on API Gateway
However, when I hit the API through postman, I'm able to get a successful GET Request.
Successful message on Postman
This is how I know I'm hitting the correct API successfully but I'm not able to figure out why I'm getting a 504 error message on API Gateway.
Make sure that your backend integration includes only the logic needed for API Gateway to send an HTTP response to the client. Consider moving any nondependent or post-processing logic to another service, such as AWS Lambda.
If network latencies are causing the 504 error, implement retry logic on the client-side application.

Invoking lambda from API gateway test, but hitting the endpoint does not invoke the lambda. 500 returned

I have an api gateway that triggers a lambda method. I'm trying to hit the endpoint and I get a 500 returned, InternalServerErrorException. However, the lambda was never invoked.
When logging into the aws console, I run the test interface in the api gateway. I get a 502, InternalServerErrorException. Logs say the lambda timed out after 3 seconds. Viewing cloudwatch it's clear the lambda was invoked this time.
I can't find any documentation on why I would be getting a 500 InternalServerErrorException when hitting the endpoint and it would not invoke the lambda, but I would be able to invoke it with the test button.
Any help would be greatly appreciated. I've been struggling for a bit with this one. Thanks!
If your API is working properly with the test button, but, you are receiving this error, looks like your API is not deployed.
To deploy your API go to Actions > Deploy API:

Getting '502 Bad Gateway' from AWS api gateway

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 /!\

AWS API Gateway - Step Function Integration, 500 Error on Success

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.

How to setup a GET method in AWS API Gateway?

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.