angular-live-set icon indicating copy to clipboard operation
angular-live-set copied to clipboard

Error when testing change stream

Open stellanhaglund opened this issue 11 years ago • 5 comments

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)

stellanhaglund avatar Aug 28 '15 14:08 stellanhaglund

I think this related to an incompatibility with the compression middleware.

ritch avatar Aug 28 '15 19:08 ritch

@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.

njcaruso avatar Sep 15 '15 02:09 njcaruso

@stellanhaglund Did Ritch's suggestion to turn off compression fix your error?

0candy avatar Mar 28 '16 20:03 0candy

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?

bajtos avatar Mar 30 '16 08:03 bajtos

I have made the change to set the response header to no compression when using event stream. Closing this issue.

0candy avatar Apr 25 '16 18:04 0candy