AWS Lambda "Process exited before completing request"
Take a look at your memory consumption (included in last log line). I got the same message when I assigned too little memory to my lambda function.
I have used callback
, instead of context
.
More recent examples on aws website use callback
instead of context
.
To complete request, either of the below must be called:
callback(error); // This is used when there is an error
// or
callback(null, data); // This is used when there is a success
// 'data' will contain success result, like some JSON object
When lambda execution completes the request,
failing to call one of the above callbacks,
you will see below error:
"Process exited before completing request."
The message "Process exited before completing request" means that the Javascript function exited before calling context.done
(or context.succeed
, etc.). Usually, this means that there is some error in your code.
I'm not a Javascript expert (at all) so there may be more elegant ways to find the error but my approach has been to put a bunch of console.log
messages in my code, run it, and then look at the logs. I can usually zero in on the offending line and, if I look at it long enough, I can usually figure out my mistake.
I see you have some logging already. What are you seeing in the output?