Reputation: 21830
I have a lambda function that is wired up to work with API Gateway. When I run it locally it works, when I simulate it with serverless offline
it works.
But against the published dev endpoint, it returns an error 500 and a json object with an error message:
{
"message": "Internal server error"
}
In the CloudWatch logs, there are no errors. In the callstack in the API gateway endpoint testing page, I see my correct response body in the Lambda portion of the process, and then when it gets to the API gateway response step, something goes wrong.
How should I debug API Gateway when there aren't any errors in logs?
Upvotes: 4
Views: 1061
Reputation: 1339
To get API Gateway feeding cloudWatch :
AmazonAPIGatewayPushToCloudWatchLogs
in IAMarn:aws:iam::<account id>:role/<role name>
<API name>
> Stages > Settings > CloudWatch Settings and :
Now your logs can be viewed in :
under a name like API-Gateway-Execution-Logs_<api id>/<api stage>
Upvotes: 0
Reputation: 173
If you're writing it in node, it could be that your node version is different than 4.3.2 (the one that AWS Lambda uses) and that's why testing offline and locally works but not in the AWS Lambda.
This happened to me before, when I was using let
.
You could use nvm to install node v 4.3.2 to test it locally or you could look here to see what features are you allowed to use in your code.
Upvotes: 1