I am new to AWS, I am getting {"message": "Internal server error"}
while running the Lambda function with API Gateway in Postman.
I have checked the CloudWatchLogs
, there is no error showing in the logs. But Postman returning {"message": "Internal server error"}
this error.
It happens when you don't return the correct API Gateway format.
Try to return this in your Lambda:
def lambda_handler(event, context):
return {
"statusCode": 200,
"body": "{'Test': 'Test'}",
"headers": {
'Content-Type': 'text/html',
}
}
According to the log message you provide, it looks like the log from your Lambda function. I recommend you to enable logging feature on API Gateway side or you can use the test invoke feature on API Gateway console. They both are able to help you to debug your API.
Here is the common issues which might be able to help you diagnose the issue. 1. It doesn't have a right permission to allow API Gateway invoke your Lambda function. 2. It is set as AWS Service Proxy to your Lambda function, the response from your Lambda function doesn't return the response in the proper format.
Ref: https://forums.aws.amazon.com/thread.jspa?messageID=916452
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With