Error when testing change stream
Web server listening at: http://0.0.0.0:3000/ Error: Can't set headers after they are sent. at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:335:11) at ServerResponse.res.setHeader (/Users/stellanhaglund/Documents/oopy/node_modules/loopback-explorer/node_modules/express/node_modules/connect/lib/patch.js:134:22) at ServerResponse.header (node_modules/loopback/node_modules/express/lib/response.js:718:10) at ServerResponse.send (node_modules/loopback/node_modules/express/lib/response.js:163:12) at ServerResponse.json (node_modules/loopback/node_modules/express/lib/response.js:249:15) at ServerResponse.send (node_modules/loopback/node_modules/express/lib/response.js:151:21) at defaultHandler (node_modules/loopback/node_modules/strong-remoting/lib/rest-adapter.js:380:11) at restErrorHandler (node_modules/loopback/node_modules/strong-remoting/lib/rest-adapter.js:347:14) at Layer.handle_error (node_modules/loopback/node_modules/express/lib/router/layer.js:71:5) at trim_prefix (node_modules/loopback/node_modules/express/lib/router/index.js:310:13)
I think this related to an incompatibility with the compression middleware.
@ritch - I'd recommend you update the README file to warn users to turn off compression, since many configs probably have compression turned on by default see documentation.
Any suggestions in the interim for turning off compression? Is there another workaround, while still keeping compression?
Also, if you have a place to recommend troubleshooting tips, for users that proxy via NGINX, this tip helped me out too troubleshooting - although it's not related to the compression issue. http://stackoverflow.com/questions/13672743/eventsource-server-sent-events-through-nginx
PS - great tool with LiveSet. After a few hours troubleshooting, I finally got it working. Now time to have fun experimenting with it. Thanks for the repo and example repo.
@stellanhaglund Did Ritch's suggestion to turn off compression fix your error?
Makes me wonder, can we improve strong-remoting and/or loopback live-set method to detect the situation when compression is turned on and report a warning to console?
I have made the change to set the response header to no compression when using event stream. Closing this issue.