From 32d70a83d1e36583b3469d11ad4880727ac002ec Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Thu, 11 Jan 2024 23:38:10 +0100 Subject: [PATCH] Fix debug dump-ws crashing the controller When ws was updated to version 8 it came with a breaking change where message data was no longer utf8 decoded from binary to a string. The main codepath handling messages was updated to handle this but the ws dump path was not resulting in the controller crashing when receiving a message that is then forwarded to the dumper without decoding. Fix by decoding the message in the dump-ws path. --- packages/controller/src/WsServer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/controller/src/WsServer.ts b/packages/controller/src/WsServer.ts index fb10cc66..e4b86251 100644 --- a/packages/controller/src/WsServer.ts +++ b/packages/controller/src/WsServer.ts @@ -107,7 +107,7 @@ export default class WsServer { socket.on("message", (message: WebSocket.RawData) => { wsMessageCounter.labels("in").inc(); if (!socket.clusterio_ignore_dump) { - this.controller.debugEvents.emit("message", { direction: "in", content: message }); + this.controller.debugEvents.emit("message", { direction: "in", content: message.toString("utf8") }); } }); let originalSend = socket.send;