Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prisma DATABASE_URL error (Cloud Run + Cloud SQL)

I use Prisma with Cloud Run & Cloud SQL. After providing DATABASE_URL to the prisma.schema it throws me an error in runtime.

Can't reach database server at `(/cloudsql/project-name:us-east1:database-id)`:`5432`
Please make sure your database server is running at `(/cloudsql/project-name:us-east1:database-id)`:`5432`."
  • Database: Postgres
  • Provided url DATABASE_URL: postgresql://username:password@localhost/databasename?host=(/cloudsql/project-name:us-east1:database-id)

What is wrong with connection? Do I failed to construct DATABASE_URL correctly?

like image 240
Roman Mahotskyi Avatar asked Oct 29 '25 14:10

Roman Mahotskyi


1 Answers

I removed brackets () around host parameter /cloudsql/project-name:us-east1:database-id and everything start to work as expected.

Before (with brackets)

postgresql://username:password@localhost/databasename?host=(/cloudsql/project-name:us-east1:database-id)

After (without brackets)

postgresql://username:password@localhost/databasename?host=/cloudsql/project-name:us-east1:database-id
like image 155
Roman Mahotskyi Avatar answered Oct 31 '25 11:10

Roman Mahotskyi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!