🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(database): attach error listeners to Neon/Node pools to prevent Lambda crash (#14606)
Arvin Xu8fa7607747c8
diff --git a/packages/database/src/core/web-server.ts b/packages/database/src/core/web-server.tsindex d7070147ab5..6acb4304733 100644--- a/packages/database/src/core/web-server.ts+++ b/packages/database/src/core/web-server.ts@@ -30,6 +30,16 @@ If you don't have it, please run \`openssl rand -base64 32\` to create one.if (serverDBEnv.DATABASE_DRIVER === 'node') {const client = new NodePool({ connectionString });+ // pg.Pool emits 'error' on idle clients when the backend connection drops.+ // Without a listener Node escalates it to uncaughtException and exits the process.+ // See: https://node-postgres.com/apis/pool#error+ client.on('error', (err) => {+ console.error('[NodePool] idle client error (swallowed to prevent process crash):', {+ code: (err as NodeJS.ErrnoException).code,+ message: err.message,+ stack: err.stack,+ });+ });return nodeDrizzle(client, { schema });}@@ -39,5 +49,15 @@ If you don't have it, please run \`openssl rand -base64 32\` to create one.}const client = new NeonPool({ connectionString });+ // NeonPool runs over WebSocket; transient drops surface as 'error' on the pool.+ // Without a listener Node escalates it to uncaughtException — on Vercel this killed+ // the entire Lambda 1800+ times in 5 minutes (see LOBE-8704).+ client.on('error', (err: Error) => {+ console.error('[NeonPool] idle client error (swallowed to prevent process crash):', {+ code: (err as NodeJS.ErrnoException).code,+ message: err.message,+ stack: err.stack,+ });+ });return neonDrizzle(client, { schema });};