I've an express application running on node.js 0.12 which is clustered
When I try to run inside a middleware a
res.setHeader i get the following error:
TypeError: Cannot set property 'server' of undefined _stream_readable.js:505 dest.end(); ^ TypeError: undefined is not a function at Stream.onend (_stream_readable.js:505:10) at Stream.g (events.js:199:16) at Stream.emit (events.js:129:20) at _stream_readable.js:908:16 at process._tickCallback (node.js:355:11)
I've spent the last days trying to figure out what's happening, but the application is properly initialized. It's running inside a function because the application is
Of course I'm unable to use any function which tries to set an header inside my application because of this error, this is just a test I've made to figure out what's the problem.
Any idea? For completeness here's the code of the application file, called by
cluster (only by workers).