Supabase pooler causing Node.js server crash after DB query
I'm using a Node.js backend with Express and the pg package to connect to a Supabase (Free Tier) PostgreSQL database. I'm connecting through the Supabase connection pooler (aws-0-ap-south-1.pooler.supabase.com) with SSL enabled (rejectUnauthorized: false).
The server starts up fine. When I send a login request via Postman, it completes successfully and returns a token. But immediately after that, the server crashes. The same thing happens when I try to access a dashboard route that makes a query using the same pool connection.Tjhe route responds once, then the server crashes and has to be restarted.
Here's my DB connection code:
The error I'm getting is:
Has anyone run into this when using the Supabase connection pooler? Not sure if it's something to do with Supabase shutting down idle clients, the Free Tier limitations, or something wrong with my connection setup.
I'm on Windows 11 and using pg@8.11.3.
Would appreciate any ideas on what might be causing this or how to prevent the crash.
0 Replies