#vercel#Supabase

“Works on My Machine” Until Vercel Says No

2/3/2026
2 min read
16 VIEWS

Everything worked perfectly on my local machine.
Then I deployed to Vercel… and instantly hit Prisma Error P1001: Can’t reach database server.

The problem wasn’t my code; it was the environment.

Locally, my app runs as a single long-lived process, so Prisma opens one database connection and reuses it. In production, Vercel runs serverless functions. Each incoming request can spin up a new instance, and each instance opens its own database connection.

Under real traffic, those connections add up fast until the database refuses new ones.

The fix was simple but crucial: I switched to Supabase’s connection pooler (port 6543). Instead of every request opening a fresh connection, the pooler manages and reuses a limited number of connections, keeping the database stable.

Lesson learned: “It works on my machine” doesn’t mean it’s production-ready. Serverless changes the rules, and your database setup has to change with it.

LOG_REF: cml6mcm96000004k02g6i5g3k // UPDATED Wed Feb 04 2026