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));