I'm trying to connect Prisma to a Supabase PostgreSQL database but keep getting P1001: Can't reach database server errors. Here's my setup:
Environment OS: Windows 11
Tools: Prisma (+ Node.js), Supabase
Connection: Using Supabase's connection pooler
Error pnpm dlx prisma db push
Error: P1001: Can't reach database server at `aws-0-eu-central-2.pooler.supabase.com:5432`
Configuration
Prisma Schema:
prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
.env File:
env
DATABASE_URL="postgresql://postgres.ecvujsgsaevhjcvlslbw:[password]@aws-0-eu-central-2.pooler.supabase.com:6543/postgres?pgbouncer=true&sslmode=require"
DIRECT_URL="postgresql://postgres.ecvujsgsaevhjcvlslbw:[password]@aws-0-eu-central-2.pooler.supabase.com:5432/postgres?sslmode=require"
Diagnostics Performed
Tested with both pooler (6543) and direct (5432) ports
Question Why does Prisma fail to connect and How can I Fix this?