Description
Version
v16.15.1
Platform
Linux xxxxx-HP-EliteBook-840-G3 5.13.0-44-generic #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
Running node as a development server with a proxy.conf.js file that looks like:
const PROXY_CONFIG = {
"/graphql" : {
target: "https://localhost:443/graphql",
router: function(req) {
return "https://localhost:443/graphql"
},
changeOrigin: true,
secure: false,
logLevel: "debug",
ws: true
}
};
module.exports = PROXY_CONFIG;
Proxying graphql calls (queries, mutations and subscriptions through websockets) from an Angular application using an Apollo client.
The Proxy was working well with an earlier version of node, but post upgrade to 16.15.1 (LTS), I get this error on starting ng serve:
✔ Compiled successfully.
[HPM] Router new target: https://localhost:443/graphql -> "https://localhost:443/graphql"
[HPM] GET /graphql/ -> https://localhost:443/graphql
[HPM] Upgrading to WebSocket
[HPM] Router new target: https://localhost:443/graphql -> "https://localhost:443/graphql"
[HPM] GET /graphql/ -> https://localhost:443/graphql
[HPM] Upgrading to WebSocket
[HPM] Router new target: https://localhost:443/graphql -> "https://localhost:443/graphql"
[HPM] GET /graphql/ -> https://localhost:443/graphql
[HPM] Upgrading to WebSocket
[HPM] Router new target: https://localhost:443/graphql -> "https://localhost:443/graphql"
[HPM] GET /graphql/ -> https://localhost:443/graphql
[HPM] Upgrading to WebSocket
node:events:505
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:160:15)
at writeGeneric (node:internal/stream_base_commons:151:3)
at Socket._writeGeneric (node:net:817:11)
at Socket._write (node:net:829:8)
at writeOrBuffer (node:internal/streams/writable:389:12)
at _write (node:internal/streams/writable:330:10)
at Socket.Writable.write (node:internal/streams/writable:334:10)
at IncomingMessage.ondata (node:internal/streams/readable:754:22)
at IncomingMessage.emit (node:events:527:28)
at IncomingMessage.Readable.read (node:internal/streams/readable:527:10)
Emitted 'error' event on Socket instance at:
at Socket.onerror (node:internal/streams/readable:773:14)
at Socket.emit (node:events:527:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
This happens as soon as I bring the application up in the browser. Looks like upgrading to Websocket is failing with this error.
Proxying to a Django server with Graphql support.
How often does it reproduce? Is there a required condition?
Everytime. If I set 'ws:false', the error does not happen
What is the expected behavior?
No EPIPE write error and node stays up and services the graphql calls by proxying them to the Django server.
What do you see instead?
EPIPE write error as shown in the output above.
Additional information
No response