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.
Was this page helpful?