More than 10 lines in a node.js stack error?

Easiest solution for that is to start your code with following:

Error.stackTraceLimit = Infinity;

If you'd like to see stack trace that spans over setTimeout/setInterval calls, then more sophisticated https://github.com/mattinsler/longjohn would be the way to go.


You can pass stack trace limit as a command line param to node:

node --stack-trace-limit=1000 debug.js // default 10

BTW, another thing which sounds unlikely to happen, but just wasted a few hours of my time for debugging, is the stack size (which defaults to 492 kB). You can have very uninformative errors if the stack is exhausted (RangeError without any additional info). You can increase the stack size with:

node --stack-size=1024 debug.js // default 492

In the world of callback-to-callback-to-callback chainings, it's in fact very easy to exceed the stack size for big input sizes, if the program is not written in this in mind.

To see all stack-related options:

node --v8-options | grep -B0 -A1 stack