I have a fairly complex lambda function
that is quitting mid-operation with no apparent explanation.
It is no where near its time or memory limit and it suddenly just has an END and REPORT in the logs with no errors reported.
Note that it does not hang; it is a very short execution. Is there a way that something in Node can Segfault without it causing an error to be reported?
How do I dig deeper into this? I have audited the code many times over, and it exits very deep in the loop with a parallel async command running. I am not detecting an error being thrown from any of the callbacks. It simply stops.
After a fairly deep investigation, I believe the issue is that AWS Lambda is terminating the execution because there are no remaining processes waiting. Keep in mind that by default, lambda does not stop execution just because you call the main callback or context and will keep executing. Unless a special flag in the context is set, it will continue to operate until timeout or until all the processes are finished. In my case, I tracked it down into an error in the node-apn package where a promise was not coming back after a push notification. Not sure of a resolution besides taking it out for now.
I had this after missing an await
before an async function
call.
I spent far too long going down the rabbit hole of trying to work out why it was failing at the last point it logged - which was always the same every run (by chance, or rather the time it took).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With