events.js:85
throw er; // Unhandled 'error' event
^
Error: Parse Error
at Error (native)
at Socket.socketOnData (_http_client.js:317:20)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:538:20)
What can be the possible cause of this error? And where can I put the try-catch or fun(err) for error handling! I'm even not getting the source of this error, what can be the possible source of this error?
I got a very similar stack trace when running gulp as a proxy.
Error: Parse Error
at Socket.socketOnData (_http_client.js:411:20)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at readableAddChunk (_stream_readable.js:178:18)
at Socket.Readable.push (_stream_readable.js:136:10)
at TCP.onread (net.js:563:20)
I found the root cause after a while.
The backend server was sending duplicate headers due to a bug in the backend. By removing the duplicate HTTP header This error in the javascript frontend was fixed.
Example of duplicate http headers (for example content-length):
< HTTP/1.1 200 OK
< server: Cowboy
< date: Thu, 25 Jan 2018 12:47:15 GMT
< content-length: 4789
< content-type: text/html
< content-length: 4789
< date: Thu, 25 Jan 2018 12:47:14 GMT
< server: Cowboy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With