fix: handle BigInt serialization from PostgreSQL bigserial columns

This commit is contained in:
Jason Preston
2026-08-09 00:32:06 -06:00
parent eecfe9665d
commit a89c917891
2 changed files with 9 additions and 1 deletions
+5
View File
@@ -3,6 +3,11 @@ import cors from 'cors';
import path from 'path'; import path from 'path';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import { createServer } from 'http'; import { createServer } from 'http';
// Enable BigInt JSON serialization globally
(BigInt.prototype as any).toJSON = function () {
return this.toString();
};
import { config } from './config.js'; import { config } from './config.js';
import { closeDb } from './db/index.js'; import { closeDb } from './db/index.js';
import { connectionManager } from './irc/connection-manager.js'; import { connectionManager } from './irc/connection-manager.js';
+4 -1
View File
@@ -106,7 +106,10 @@ async function persistAndPublish(
type: 'irc_event', type: 'irc_event',
eventType: data.type, eventType: data.type,
connectionId: ctx.connectionId, connectionId: ctx.connectionId,
message: msg, message: {
...msg,
id: msg.id.toString(),
},
}; };
await publisher.publish(`irc:events:${ctx.userId}`, JSON.stringify(event)); await publisher.publish(`irc:events:${ctx.userId}`, JSON.stringify(event));