'Node silently exits with exit code 0. Problem with number of function invocations?

This is sort of a deep node question potentially and I'm not sure how best to ask it.

I've got a message coordinator function that gets a messageType and it determines which function to run like so:

switch (messageType) {
case a:
 runA();
case b:
 runB();
}

and so on.

When runA() runs, it processes 100 things sends out 100 messages to do runB(). Then runB() can send out a few SQS messages to start runC() and so on.

This seems to me to be a sort of circular loop where an invocation of runA() from the coordinator, goes back to the coordinator with a new messageType b, does runB() and then that goes back to the coordinator with a messageType c and does runC() and only at the very end, the functions should all return and the program should exit.

The problem is that in runB() , there is an axios call which doesn't error out, it just exits the program silently with exit code 0. I've noticed that if I don't put the axios call in runB() but I do it at the end of the for loop in runA() where it finishes looping over 100 records, it works and the axios call is fine. The moment I put it "deeper" in runB() does the program fail silently right at that call.

I've tried different url's, axios works in runA() but not down deeper in runB() even with the same URL and parameters.

Is there anything in node that would not be happy about these "circular" function calls? This could also be an axios problem...



Solution 1:[1]

Turns out, one of my functions was missing an "await". XD

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Adam Marciniak