© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•7mo ago•
6 replies
mkvX

Cannot connect to database on port 5432 – P1001 error and psql connection closed unexpectedly

I’m trying to run Prisma migrations and connect to my Supabase Postgres database, but the direct connection (port 5432) is failing consistently with the following error:

psql: error: connection to server at "aws-0-us-west-1.pooler.supabase.com" (52.8.172.168), port 5432 failed: server closed the connection unexpectedly
psql: error: connection to server at "aws-0-us-west-1.pooler.supabase.com" (52.8.172.168), port 5432 failed: server closed the connection unexpectedly


This probably means the server terminated abnormally before or while processing the request.
Port 6543 (pgbouncer) works fine for queries.

Port 5432 (direct) is not responding even via pg_isready.

Prisma throws Error: P1001: Can't reach database server at aws-0-us-west-1.pooler.supabase.com:5432.
Prisma throws Error: P1001: Can't reach database server at aws-0-us-west-1.pooler.supabase.com:5432.


What I’m trying to achieve:
Run Prisma migrations using the DIRECT_URL as recommended. I need the direct connection for schema updates and for prisma migrate dev/reset.

What I’ve tried:
Verified credentials and tenant ID in the connection string.

Tested multiple networks (WiFi, mobile hotspot, VPN off).

Used both aws-0-us-west-1.pooler.supabase.com and db.<project-ref>.supabase.co hosts.

Verified that the project is active in the dashboard.

Port test results:
pg_isready -p 6543 → accepting connections
pg_isready -p 5432 → no response
pg_isready -p 6543 → accepting connections
pg_isready -p 5432 → no response



Environment details:
OS: Windows 11
Framework: Node.js 20.x
ORM: Prisma @latest
Platform: Supabase hosted Postgres (US West region)
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Cannot connect to database using supervisor port (5432) after change password
SupabaseSSupabase / help-and-questions
5mo ago
Cannot connect to database with psql or Supabase CLI
SupabaseSSupabase / help-and-questions
4mo ago
Direct Database Connection Refusing Port 5432 After Working Yesterday
SupabaseSSupabase / help-and-questions
3mo ago
server closed the connection unexpectedly
SupabaseSSupabase / help-and-questions
13mo ago