I am trying to work out where in my code is causing the following error which ends up crashing the system
_http_outgoing.js:536
throw new ERR_HTTP_HEADERS_SENT('set');
^
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:536:11)
at ServerResponse.header (/home/(APP)/node_modules/express/lib/response.js:771:10)
at ServerResponse.send (/home/(APP)/node_modules/express/lib/response.js:170:12)
at /home/(APP)/app.js:209:23
at ChildProcess.exithandler (child_process.js:299:7)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1051:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
code: 'ERR_HTTP_HEADERS_SENT'
}
I don't mind it throwing the error, but I don't want it crashing my nodejs application. Any suggestions on finding what part of the code could cause this.