Issue Connecting to Railway PostgreSQL via Prisma (CLI Works Fine)
amp
PROOP

7 months ago

Hi Railway Support Team,

I'm experiencing an issue connecting to my Railway-hosted PostgreSQL database using Prisma in a Node.js/NestJS application.

  • I’m able to connect to the database using the Railway CLI and psql.

  • However, when I try to connect using Prisma, I receive the following error:

PrismaClientInitializationError: Can't reach database server at

Error Code: P1001

I've confirmed the following:

  • The DATABASE_URL is correct and working in another Prisma project (same connection string).

  • I’ve added ?sslmode=require to the connection string.

  • Prisma is on the latest version (@prisma/client and prisma).

  • The project’s .env is loaded correctly and the Prisma schema is valid.

  • Other projects using the same database connect without issue.

Given all this, it seems the issue may be related to how DNS or SSL is handled through database in this specific environment. Do you have any known issues with Prisma and your proxy endpoints, or any suggestions on improving Prisma connectivity?

I’d appreciate any guidance or insights you could provide.

Solved

1 Replies

itsrems
EMPLOYEE

7 months ago

Where are you running this command from ? What database host are you using ?

If you're running prisma on your own machine you'll need to enable to TCP proxy and use the database's public URL, as the default one uses railway's private networking which is not exposed to the internet.


Status changed to Awaiting User Response Railway 7 months ago


Railway
BOT

4 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 4 months ago


Loading...