neondatabase / serverless

Connect to Neon PostgreSQL from serverless/worker/edge functions
https://www.npmjs.com/package/@neondatabase/serverless
MIT License
318 stars 11 forks source link

Cryptic prepared statement errors #53

Closed ffxsam closed 2 months ago

ffxsam commented 7 months ago

Steps to reproduce

Unknown (error is sporadic)

Expected result

???

Actual result

Randomly, I'm seeing cryptic errors like this:

|  Error: DB error: ERROR: prepared statement "s996" does not exist

Caused by:
    ERROR: prepared statement "s996" does not exist
   NeonDbError: db error: ERROR: prepared statement "s996" does not exist

Then if I reload our app, it runs just fine (with no code changes).

Environment

Node.js 18.x, Lambda, SST, working locally (SST dev mode)

davidchalifoux commented 7 months ago

I'm also experiencing these errors. I'm wondering if it's because I'm using a pooled connection string.

ffxsam commented 7 months ago

@davidchalifoux I was advised not to use the pooled connection (for now), and to use neonConfig to set this:

import { neon, neonConfig } from '@neondatabase/serverless';

neonConfig.fetchConnectionCache = true;
jawj commented 4 months ago

@conradludgate Am I right in thinking that the latest pgbouncer is now rolled out in production, and is expected to stop this happening?

jawj commented 2 months ago

I believe that deployment of the latest pgbouncer some time ago should have fixed this. Please reopen if that's not the case.