N
Neon7mo ago
optimistic-gold

P1001: Can't reach database server at `localhost:5432`

Hey, im using Neon and Prisma in my Next.Js project, when i try to push my db for the first time i get this error. i already read foruns and the Prisma and Neon doc, all they say to add a connect_timeout to the URL, i did it and the error persist. In my .env: DATABASE_URL="postgresql://mydb_owner:<password>@ep-mute-term-a52thx58-pooler.us-east-2.aws.neon.tech/mydb?sslmode=require&connect_timeout=15&pool_timeout=15" In my schema: generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } The error: Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma Datasource "db": PostgreSQL database "mydb", schema "public" at "localhost:5432" Error: P1001: Can't reach database server at localhost:5432 Please make sure your database server is running at localhost:5432. Im using the github codespace, i dont know if this can change the things.
1 Reply
ambitious-aqua
ambitious-aqua7mo ago
You might try this configuration here, using a direct connection for migrations: https://github.com/neondatabase/examples/blob/main/with-nextjs-prisma/prisma/schema.prisma
GitHub
examples/with-nextjs-prisma/prisma/schema.prisma at main · neondata...
Examples and code snippets demonstrating common ways of integrating Neon with various frameworks and languages. - neondatabase/examples

Did you find this page helpful?