node.jsvash

How to find the source of 'write after end'


Sometimes, my (large) application gives the following error:

Error: write after end
at ServerResponse.OutgoingMessage.write(_http_outgoing.js:413:15)
at ServerResponse.res.write(/nodeapp/node_modules/express/node_modules/connect/lib/middleware/compress.js:110:17)
at ServerResponse.res.end(/nodeapp/node_modules/express/node_modules/connect/lib/middleware/compress.js:116:14)
at ServerResponse.res.send(/nodeapp/node_modules/express/lib/response.js:153:8)
at fn(/nodeapp/node_modules/express/lib/response.js:797:10)
at/nodeapp/node_modules/vash/build/vash.js:2082:4
at Object.vash.loadFile (/nodeapp/node_modules/vash/build/vash.js:2070:10)
at View.vash.renderFile [as engine] (/nodeapp/node_modules/vash/build/vash.js:2078:8)
at View.render (/nodeapp/node_modules/express/lib/view.js:76:8)
at Function.app.render (/nodeapp/node_modules/express/lib/application.js:504:10)

Is there a way to find out in which line this error happend? Normally the file is mentioned in the stack trace, but not in this case. Is it even from my code or can it also be caused by vash or another module?

I am using vash v0.7.12-1.


Solution

  • I solved it by increasing the stacktrace limit:

    Error.stackTraceLimit = 20;