Http-proxy crashes my react site RANDOMLY
Our site is using Nodejs v.12
We are using npm run start which just executes npm-run-all -p watch-css start-js
Our problem is that our app compiles and after random amount of time (somtimes its instantly, sometimes it's after 10-20 seconds) crashes and I get this error...
Any idea on why is this happening?
We have setuped proxy in our package.json like this:
"proxy": "http://localhost:3000",
Compiled successfully!
You can now view frontend in the browser.
Local: http://localhost:3000/
On Your Network: http://192.168.4.127:3000/
Note that the development build is not optimized.
To create a production build, use yarn build.
events.js:291
throw er; // Unhandled 'error' event
^
Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
at doWrite (_stream_writable.js:399:19)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at ClientRequest.<anonymous> (/home/ruby/Desktop/work/marshall/frontend/node_modules/http-proxy/lib/http-proxy/passes/ws-incoming.js:115:16)
at ClientRequest.emit (events.js:314:20)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:601:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:122:17)
at Socket.socketOnData (_http_client.js:474:22)
at Socket.emit (events.js:314:20)
at addChunk (_stream_readable.js:297:12)
at readableAddChunk (_stream_readable.js:272:9)
at Socket.Readable.push (_stream_readable.js:213:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
Emitted 'error' event on Socket instance at:
at errorOrDestroy (internal/streams/destroy.js:108:12)
at onwriteError (_stream_writable.js:418:5)
at onwrite (_stream_writable.js:445:5)
at doWrite (_stream_writable.js:399:11)
at writeOrBuffer (_stream_writable.js:387:5)
[... lines matching original stack trace ...]
at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
code: 'ERR_STREAM_DESTROYED'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@0.1.0 start-js: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@0.1.0 start-js script.