I've inherited a nodejs application with reasonable complexity. It interacts with 5 other applications through various network interfaces, mostly HTTP REST APIs. Every now and then I run into an issue where an error is thrown, and while its handled to prevent the application from crashing, I can't tell where the error is coming from. Here's a typical amount of information I get from this error:
- connect ECONNREFUSED
- util.js:L746
- net.js:1000
And that's it. That's the entire message and stacktrace (message is actually duplicated in errno=ECONNREFUSED
and syscall=connect
, not helping). I'm using nodejs 0.12.2 and linked the stacktrace lines to the source accordingly. I've read the source but didn't get anywhere.
I've also looked through the many questions here on SO related to ECONNREFUSED
, but those always come with a code example. If I knew what part of my applicatino is response for the network request, I could fix it.
So my question is, how can I instrument a node application to find out where failed requests like this come from?
PS: I've also looked at the recommendations for debugging nodejs applications, but didn't find anything answering my question.