1

I have an API that I host using Lambda (nodejs), with API-gateway. I'm using serverless to deploy.

Generally things have been fine, but while I was working on a specific function today, I started to receive HTTP 500 errors when hitting the endpoint. However, while there were still API-Gateway access logs for the end point, there were no Cloudwatch logs for the lambda functions getting hit. I was able to verify that the Authorizer was getting hit successfully, and not returning any issue (if it was, it would have been a 401). After using CLI tools to invoke the function from the command line, the 500 error went away and I was able to successfully hit the endpoints again.

Has anyone ever ran into this before? If I'm missing a debug step, I would really like to know. It was really concerning that my API could be generating 500 errors with no paper trail to help me understand what was happening.

Todd Anderson
  • 1,138
  • 9
  • 21
  • In the Api Gateway Logs for that request, what is the complete response message? And how much time it takes to respond? – OARP Jan 10 '22 at 06:48
  • it's a short log and it only logs the inbound request, not the response. However in my experience the responses were nearly instant, <200ms "requestId": "XX", "ip": "XX", "requestTime": "10/Jan/2022:05:50:20 +0000", "httpMethod": "POST", "routeKey": "POST XX", "status": "500", "protocol": "HTTP/1.1", "responseLength": "35" – Todd Anderson Jan 10 '22 at 08:24

1 Answers1

0

You can check your role and permissions ,this link could help you https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-lambda-stage-variable-500/

Also you can debug further with X-ray : https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html

Rohit
  • 3,314
  • 1
  • 13
  • 15
  • I'll give x-ray a try. I went through the guide you linked already; but I don't think any of it applies as the function was working perfectly fine and is now doing so again without me changing anything in that guide – Todd Anderson Jan 10 '22 at 08:29