The short version
Supabase uses IPv6 by default. Most local dev environments and many hosting providers don't support IPv6, so DNS resolution fails with ENOTFOUND or hangs with ETIMEDOUT. The fix: use the transaction pooler connection string (port 6543) instead of the direct connection (port 5432).
The error
Error: getaddrinfo ENOTFOUND db.xxxxxxxxx.supabase.co
This means DNS can't resolve the hostname to an IPv6 address. The second form (ETIMEDOUT) means DNS resolved but the connection timed out because your network doesn't route IPv6.
The three connection strings
Direct connection (port 5432)
Full Postgres protocol support. Supports prepared statements, SET commands, LISTEN/NOTIFY. Uses IPv6 -- may fail locally.
Transaction pooler (port 6543)
Routes through Supabase's PgBouncer. IPv4-compatible -- works everywhere. Does NOT support prepared statements or SET commands. Best for most web apps.
Session pooler (port 6543 + session_mode)
Same as transaction pooler but preserves session state. Supports SET but not prepared statements. Use if you need SET search_path.
Which one to use
| Use case | Connection string |
|---|---|
| Local dev (Node.js, Python) | Transaction pooler (6543) |
| Vercel / Railway / Render | Transaction pooler (6543) |
| Cloudflare Workers | Transaction pooler (6543) |
| Prisma ORM | Transaction pooler (6543) + ?pgbouncer=true |
| pg_dump / pg_restore | Direct connection (5432) |
| Migrations (Prisma, Knex) | Direct connection (5432) |
The Prisma gotcha
Prisma uses prepared statements by default. The transaction pooler doesn't support them, so you'll get prepared statement "stmt_1" does not exist. Fix: add ?pgbouncer=true to your connection string.
FAQ
Why does my app work on Vercel but not locally?
Vercel supports IPv6. Your local machine might not. Use the pooler (6543) locally.
What's the difference between transaction and session pooler?
Transaction pooler resets after each transaction (faster). Session pooler preserves state (needed for SET commands).
Does the pooler affect performance?
~1-2ms latency per query. Negligible for most web apps.