diff --git a/lib/core/network/protocols/httpwsProtocol.js b/lib/core/network/protocols/httpwsProtocol.js index 318f4b2c51..b9876134b2 100644 --- a/lib/core/network/protocols/httpwsProtocol.js +++ b/lib/core/network/protocols/httpwsProtocol.js @@ -313,12 +313,22 @@ class HttpWsProtocol extends Protocol { return; } + const reason = Buffer.from(message || "").toString(); + + // This hack is only here to indicate that uWebSockets killed the connection early + // because the received payload exceeded the configured threshold. + if (code === 1006 && reason.startsWith("Received too big message")) { + global.kuzzle.log.error( + `[${connection.id}] connection closed: payload exceeded the threshold`, + ); + } + if (debugWS.enabled) { debugWS( "[%s] received a `close` event (CODE: %d, REASON: %s)", connection.id, code, - Buffer.from(message || "").toString(), + reason, ); } this.entryPoint.removeConnection(connection.id);