Prisma + Supabase Error P1001

digitaldrreamer

Abdullah Bashir

Posted on July 30, 2024

Prisma + Supabase Error P1001

I was trying to use Supabase's PostgreSQL database with Prisma for a project. Don't ask me why.

I kept getting this error while I was running npx prisma migrate dev --name init to initialize my database schema:

npx prisma migrate dev --name init

Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "postgres.gunjffzpoblrok******"
Error: P1001: Can't reach database server at `postgres.gunjffzpoblrok******:5432`

Please make sure your database server is running at `postgres.gunjffzpoblrok******:5432`.
Enter fullscreen mode Exit fullscreen mode

Terminal Screenshot

After a whole lot of brain-racking and literal trauma, I found the bloody answer.

Apparently,

Don't use special characters in your database password. They could cause issues.

If you're using Supabase, go to Project Settings...

Project Settings

Database settings...
Database settings

Scroll down and click reset database password. Change the password (letters only) and update it in your .env file in your code.
Reset Password

Rerun the command, and you're good to go.
npx prisma migrate dev --name init

Happy hacking!

PS: Prisma Migration got stuck minutes later (facepalm). Solution here.

💖 💪 🙅 🚩
digitaldrreamer
Abdullah Bashir

Posted on July 30, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Prisma + Supabase Error P1001
supabase Prisma + Supabase Error P1001

July 30, 2024