Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.x
Plugin version
7.1.3
Node.js version
14.x
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Azure AppServices for linux (Node running inside docker container)
Description
We are getting some intermittent container crashes and looking at the logs looks like source of the exception is @fastify/websockets
(logs below). We are using @fastify in combination with TRPC subscriptions for real-time communication.
Container exited unexpectedly: last 10 seconds logs [2023-04-17T06:26:19.633055587Z Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
2023-04-17T06:26:19.633108688Z Please open an issue with this stack trace at https://github.com/nodejs/node/issues
2023-04-17T06:26:19.633116188Z
2023-04-17T06:26:19.633120988Z at new NodeError (internal/errors.js:322:7)
2023-04-17T06:26:19.633126088Z at assert (internal/assert.js:14:11)
2023-04-17T06:26:19.633131288Z at ServerResponse.assignSocket (_http_server.js:225:3)
2023-04-17T06:26:19.633136088Z at Server. (/usr/src/app/server/dist/node_modules/@fastify/websocket/index.js:52:19)
2023-04-17T06:26:19.633141288Z at Server.emit (events.js:400:28)
2023-04-17T06:26:19.633145788Z at Server.emit (domain.js:475:12)
2023-04-17T06:26:19.633149988Z at onParserExecuteCommon (_http_server.js:703:14)
2023-04-17T06:26:19.633154388Z at onParserExecute (_http_server.js:616:3) {
2023-04-17T06:26:19.633159188Z code: 'ERR_INTERNAL_ASSERTION'
2023-04-17T06:26:19.633164488Z }
]
I believe server should not completely crash and restart on such websocket errors. Any help or guidelines on we can resolve this problem. Not sure if this is the right place to raise the issue as the problem could be in the fastify plugin for TRPC? But from the error logs we can only pinpoint to @fastify/websocket
.
Thanks
Steps to Reproduce
We are unable to reproduce this issue in our development or staging environments, it is happening only in production.
Expected Behavior
The server should not crash with an ERR_INTERNAL_ASSERTION error.