Reputation: 1495
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 (npm run deploy
), all I get is internal server error when I make a GET request. 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 won't be able to detect. My best guess is that this issue is either related to my local node version (which is higher than the Node 8 LTS that AWS uses) or something in my AWS CloudFormation stack that the offline doesn't emulate. Since I think an error caused by an older Node version would log something, I think the error is with something involving API Gateway. That's pure conjecture and I don't have a good way of verifying that.
Upvotes: 2
Views: 756
Reputation: 1495
The issue was that AWS wasn't automatically calling JSON.stringify()
on the response but the offline serverless plugin was. I'm still not sure why that would lead to a log-less error but it definitely does fix it.
Upvotes: 1