I’m writing a function to be deployed to AWS Lambda using node 8 (it’s OSS, take a look: https://github.com/hacksecure/utility-serverless-functions). It runs perfectly on local (npm run dev) but when deployed, all I get is internal server error. The Cloudwatch logs have nothing besides the logs showing the request started, ended and specifications on the billing. The issue looks similar to this but pinning my version of Serverless to 1.25.x (as you can see in the package.json) did nothing. I do not have serverless globally installed so I know there’s no sort of weird version conflict.
I can’t find any good examples of anything but the simplest Promise based lambda functions so it’s very possible that my code has some flaw that serverless-offline can’t spot. Any thoughts?
I’ve had this error when my response didn’t have a “statusCode” property. Then I had the the same error when trying to add extra fields to the response, later learning that my data has to go under the “body” property. Maybe you are having the same issue
In the end I created a response wrapper:
Make sure you do both. If you reject the promise then the API GW will detect that Lambda failed and send back an error message but not the one you’re trying to send. You need to resolve and set the response to be your error.
So the MySQL DB is in another ASW root account , I created a new one just for testing serverless framework ,
but I am able to connect from my local environment and working normally.
I tried context.callbackWaitsForEmptyEventLoop = false;
still not working : ((
Based on your responses I would focus on security groups. It sounds like your Lambdas don’t have access to the database because the security groups are blocking it.