DEV Community

Cover image for Prisma + Supabase Error P1001
Abdullah Bashir
Abdullah Bashir

Posted on

6

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.

Retry later

Top comments (2)

Collapse
 
code_monkey_038acbced924b profile image
Code Monkey

Hi, Abdullah.
How's it going?
I have the exact same errors when I migrate my schema to supabase.
I did what you wrote above exactly, and I still see that issues
Image description
What should I do at this point.
Thanks

Collapse
 
digitaldrreamer profile image
Abdullah Bashir

Hey @code_monkey_038acbced924b

  1. Have you tried regenerating npx prisma generate?
  2. If so, could you verify that your db url is correct?
Retry later