DEV Community

Ezenagu Chinemerem
Ezenagu Chinemerem

Posted on

When “Everything Is Correct” but Your Database Still Won’t Connect (Supabase + Prisma)


 I recently hit a frustrating issue while connecting Prisma to a Supabase Postgres database.

At first glance, everything looked fine:

  • Correct credentials ✅
  • Database status: healthy ✅
  • Prisma schema: valid ✅

But then:

❌ "Can't reach database server at port 5432"
❌ "Network is unreachable"
⚠️ Prisma hangs when using connection pooler


🔍 What was actually happening?

The problem wasn’t Prisma.
It wasn’t Supabase either.

It was network-level IPv6 incompatibility.

My system resolved the database host to an IPv6 address, but my ISP/network doesn’t properly support IPv6 — so the connection failed silently.


⚙️ The breakdown

Supabase gives two connection types:

  1. Direct DB (port 5432)
  • Requires stable IPv4/IPv6 support
  • Used for migrations
  • ❌ Failed in my case due to IPv6
  1. Connection Pooler (port 6543)
  • Works over IPv4
  • Designed for app runtime
  • ⚠️ Not ideal for Prisma migrations

🛠️ Current workaround

  • Using pooler for database connection
  • Forcing Prisma to run with: PRISMA_CLIENT_ENGINE_TYPE=binary
  • Skipping direct DB access for now

🤔 Open questions

  • What’s the cleanest way to handle Prisma migrations without direct DB access?
  • Are people relying on CI/CD runners or VPS environments for this?
  • Is using a VPN the most practical fix long-term?

This was a good reminder that sometimes the issue isn’t your code or config — it’s the layer beneath everything.

Would love to hear how others have handled this.

prisma #supabase #postgres #debugging #backend

Top comments (0)