alexa-app
alexa-app copied to clipboard
Simple code won't work on 3.2.0 & 4.0.0
Hello, I am running on an AWS Lambda using winston papertrail and for some reason, the lambda won't respond on 4.0.0.
You'll find the code here (to test, replace with own papertrail host/port) https://gist.github.com/quentinfasquel/78630bb57a7ab9a440f2a88f9acd5272
What's in the logs? Does the app work locally under express?
The app works super fine under express locally and I believe the issue is specific to AWS Lambda along a usage of winston-papertrail logger and alexa-app 4.0.0. If the winston logger is closed (papertrail connection is closed) and the alexa-app 4.0.0 will respond, but the logs aren't sent. Without closing, the logs are sent but it will take too long and say "the requested skill...", but alexa-app 3.2.0 works fine with that.
And the logs..
START RequestId: 37efaa4f-24ea-11e7-89ae-671b1507b1b6 Version: $LATEST
Hello World: launch
Will say hello world
Did say hello world
END RequestId: 37efaa4f-24ea-11e7-89ae-671b1507b1b6
REPORT RequestId: 37efaa4f-24ea-11e7-89ae-671b1507b1b6 Duration: 12003.37 ms Billed Duration: 12000 ms Memory Size: 128 MB Max Memory Used: 40 MB
2017-04-19T10:23:36.798Z 37efaa4f-24ea-11e7-89ae-671b1507b1b6 Task timed out after 12.00 seconds
START RequestId: 3fc51ffe-24ea-11e7-919a-51a1c5f880dc Version: $LATEST
END RequestId: 3fc51ffe-24ea-11e7-919a-51a1c5f880dc
REPORT RequestId: 3fc51ffe-24ea-11e7-919a-51a1c5f880dc Duration: 12000.28 ms Billed Duration: 12000 ms Memory Size: 128 MB Max Memory Used: 29 MB
2017-04-19T10:23:48.922Z 3fc51ffe-24ea-11e7-919a-51a1c5f880dc Task timed out after 12.00 seconds
@quentinfasquel it's difficult to tell, but I think the issue may be due to the fact that the lambda callback is waiting for an empty event loop but if you keep the papertrail connection open, this will not occur. I'm not sure why manually closing it prevents the logs from being sent, though.
Prior to 4.0.0, we were using .context
to end the lambda function rather than .callback
. You can set callbackWaitsForEmptyEventLoop = false
:
exports.handler = (event, ctx, callback) => {
ctx.waitsForEmptyEventLoop = false;
alexa.request(event)
.then(response => callback(null, response))
.catch(callback));
}
Was this ever resolved?