Closed
Description
lambda-local does not appear to wait for empty event loop. The below function should log "done" after a 1000ms timeout, but it returns before logging. I've tested with and without the -n
flag.
exports.handler = function(event, context, callback) {
setTimeout(function() {
console.log("done");
}, 1000);
context.succeed("Success");
}
$ lambda-local -l wait.js -e examples/event.js
info: START RequestId: 35f859c1-2627-3dd6-0dd0-11792f24eef9
info: End - Message
info: ------
info: Success
info: ------
info: Lambda successfully executed in 9ms.
$ lambda-local -n -l wait.js -e examples/event.js
info: START RequestId: 751dc0a1-f981-9537-6e8e-880a910be8fa
info: End - Message
info: ------
info: Success
info: ------
info: Lambda successfully executed in 8ms.