From a89c91789108b14f6abc4eee935775b04d0c4784 Mon Sep 17 00:00:00 2001 From: Jason Preston Date: Sun, 9 Aug 2026 00:32:06 -0600 Subject: [PATCH] fix: handle BigInt serialization from PostgreSQL bigserial columns --- server/src/index.ts | 5 +++++ server/src/irc/event-handlers.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/server/src/index.ts b/server/src/index.ts index 91f77e5..6dd8e44 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -3,6 +3,11 @@ import cors from 'cors'; import path from 'path'; import { fileURLToPath } from 'url'; import { createServer } from 'http'; + +// Enable BigInt JSON serialization globally +(BigInt.prototype as any).toJSON = function () { + return this.toString(); +}; import { config } from './config.js'; import { closeDb } from './db/index.js'; import { connectionManager } from './irc/connection-manager.js'; diff --git a/server/src/irc/event-handlers.ts b/server/src/irc/event-handlers.ts index 0dacc77..7b21223 100644 --- a/server/src/irc/event-handlers.ts +++ b/server/src/irc/event-handlers.ts @@ -106,7 +106,10 @@ async function persistAndPublish( type: 'irc_event', eventType: data.type, connectionId: ctx.connectionId, - message: msg, + message: { + ...msg, + id: msg.id.toString(), + }, }; await publisher.publish(`irc:events:${ctx.userId}`, JSON.stringify(event));