Prisma migration stuck?

Prisma migration stuck?

I was trying to npx prisma migrate dev –name init to a supabase Postgre db. It was stuck here for way too long. Just after getting off of Prisma’s Error P1001

npx prisma migrate dev –name init
Environment variables loaded from .env
Prisma schema loaded from prismaschema.prisma
Datasource “db”: PostgreSQL database “postgres”, schema “public” at “aws-0-us-west-1.pooler.supabase.com:5432”

Prisma migration to Supabase got stuck here for a suspiciously long time.

Fix: Change your ports from 6543 to 5432 in your DATABASE_URL and your DIRECT_URL (DIRECT_URL is necessary for migration). Stackoverflow solution here.

Before:
DATABASE_URL=postgres://[db-user].[project-ref]:[db-password]@aws-0-[aws-region].pooler.supabase.com:6543/[db-name]?pgbouncer=true&connection_limit=1
DIRECT_URL=postgres://[db-user].[project-ref]:[db-password]@aws-0-[aws-region].pooler.supabase.com:6543/[db-name]

Now:
DATABASE_URL=postgres://[db-user].[project-ref]:[db-password]@aws-0-[aws-region].pooler.supabase.com:5432/[db-name]?pgbouncer=true&connection_limit=1
DIRECT_URL=postgres://[db-user].[project-ref]:[db-password]@aws-0-[aws-region].pooler.supabase.com:5432/[db-name]

Results:

Happy Hacking!

Please follow and like us:
Pin Share