Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysterious 500 error with AWS Lambda; unable to debug

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.

like image 304
Todd Anderson Avatar asked Oct 16 '25 04:10

Todd Anderson


1 Answers

I had the exact same problem i.e. Authorizer running successfully but request returning 500 error without actually hitting the target endpoint lambda. After some trial and error I found that its occurring due to inclusion of array and object based properties in 'context' part of the IAM policy which authoriser was generating. As soon as I replaced array and object properties in context with string values it worked like a charm.

like image 69
Mohammad Umair Khan Avatar answered Oct 17 '25 19:10

Mohammad Umair Khan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!