I've encountered the same issue across all my projects. Everything runs smoothly when I work with local databases like postgres or mongodb (within a docker container on my machine). However, connecting to remote databases such as mongo db atlas, supabase, or neon results in the following error:
Error: P1001: Can't access database server at `ep-lively-bread-a2ujntlv.eu-central-1.aws.neon.tech:5432`
Please ensure that your database server is operational at `ep-lively-bread-a2ujntlv.eu-central-1.aws.neon.tech:5432`.
ELIFECYCLE Command failed with exit code 1.
Interestingly, when attempting to connect to remote databases using tools like psql, vscode database extension, or mongo compas, it works flawlessly.
In an effort to resolve this error, I have tried:
- resetting the project,
- using prisma templates,
Unfortunately, none of these attempts have been successful so far. Here's a snippet from my prisma schema:
datasource db {
provider = "postgresql"
url = env("POSTGRES_PRISMA_URL") // utilizes connection pooling
directUrl = env("POSTGRES_URL_NON_POOLING") // establishes a direct connection
}
Additionally, here are the .env variables for neon:
POSTGRES_PRISMA_URL="postgres://default:[PASSWORD]@ep-lively-bread-a2ujntlv-pooler.eu-central-1.aws.neon.tech:5432/verceldb?sslmode=require&pgbouncer=true&connect_timeout=15"
POSTGRES_URL_NON_POOLING="postgres://default:[PASSWORD]@ep-lively-bread-a2ujntlv.eu-central-1.aws.neon.tech:5432/verceldb?sslmode=require"
If you have any suggestions or solutions, they would be greatly appreciated.