-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update to nodejs10.x brings "Malformed Lambda proxy response" error #234
Comments
When testing via API-GW UI:
|
Seems like the body gets not back to the api-gw... it's always null did the interface for api-gw proxy integration change? |
My findings so far: // still works with node 10 lambda runtime
exports.handler = (event, context) => { awsServerlessExpress.proxy(server, event, context, 'CONTEXT_SUCCEED'); };
exports.handler = (event, context) => { awsServerlessExpress.proxy(server, event, context); };
exports.handler = (event, context) => awsServerlessExpress.proxy(server, event, context, 'PROMISE').promise;
// does NOT work with node 10 lambda runtime anymore
exports.handler = (event, context, callback) => { context.callbackWaitsForEmptyEventLoop = false; awsServerlessExpress.proxy(server, event, context, 'CALLBACK', callback); }; |
The question now is: how to set |
side effect with (both: node 10 or node 8 runtime) because callbackWaitsForEmptyEventLoop can't be set to false: exports.handler = (event, context) => { awsServerlessExpress.proxy(server, event, context); }; now I "sometimes" get:
But it seems to occur after the lambda function has ended (see: END RequestId....) have to switch back to node 8 with callback signature and callbackWaitsForEmptyEventLoop set to false: context.callbackWaitsForEmptyEventLoop = false;
awsServerlessExpress.proxy(server, event, context, 'CALLBACK', callback); |
Seems there are more “bugs” in node 10 runtime for lambda: https://forums.aws.amazon.com/thread.jspa?messageID=901128#901128 |
fyi: I can reproduce it with: https://github.com/lambci/docker-lambda |
I know what the problem is... The problem is in the Runtime.js: if (_isPromise(result)) {
result.then(callbackContext.succeed, callbackContext.fail);
}
else {
if (callbackContext.callbackWaitsForEmptyEventLoop) {
process.prependOnceListener('beforeExit', () => { callback(); });
}
else {
callbackContext.succeed(result);
}
} |
read this for more info: https://medium.com/@hichaelmart/reviewing-the-aws-lambda-nodejs10-x-runtime-84de1e500aac |
@adrai Thanks for posting this! I found out this today too when debugging a test lambda with https://github.com/jameskyburz/sandbox-debugger Not what people would expect that the new official node 10 runtime doesn't support async lambdas using the callback signature. |
FWIW I did flag a related issue to this to one of the more senior lambda team (https://twitter.com/tomincode/status/1131567879659425793)- but there's never any visibility with issues like this- so it's anyone's guess if/when it gets fixed. |
Seems AWS updated their nodejs10.x runtime... closing for now. |
I updated an existing lambda function runtime from node 8 to 10 now the api gateway logs say: "Malformed Lambda proxy response"
The text was updated successfully, but these errors were encountered: