Skip to content

Commit e75b2ee

Browse files
committed
fix(server): Fix incorrect native result wrapper processing via webSockets
1 parent d805b4b commit e75b2ee

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/cubejs-server/src/websocket-server.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ export class WebSocketServer {
4343
// it again - it's too expensive, instead we serialize the rest of the message and then
4444
// inject query result json into message.
4545
const resMsg = new TextDecoder().decode(await message.message.getFinalResult());
46-
message.message = '~XXXXX~';
46+
delete message.message;
4747
messageStr = JSON.stringify(message);
48-
messageStr = messageStr.replace('"~XXXXX~"', resMsg);
48+
49+
if (messageStr === '{}') {
50+
messageStr = `{"message":${resMsg}}`;
51+
} else {
52+
messageStr = messageStr.slice(0, -1) + `,"message":${resMsg}}`;
53+
}
4954
} else {
5055
messageStr = JSON.stringify(message);
5156
}

0 commit comments

Comments
 (0)