我将 Prisma 与 Cloud Run 和 Cloud SQL 结合使用。向 DATABASE_URL
提供 prisma.schema
后,它会在运行时引发错误。
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_URL
:postgresql://username:password@localhost/databasename?host=(/cloudsql/project-name:us-east1:database-id)
连接有什么问题?我是否未能正确构建 DATABASE_URL
?
答案 0 :(得分:0)
我删除了 ()
参数 host
周围的括号 /cloudsql/project-name:us-east1:database-id
,一切都开始按预期工作。
之前(带括号)
postgresql://username:password@localhost/databasename?host=(/cloudsql/project-name:us-east1:database-id)
之后(不带括号)
postgresql://username:password@localhost/databasename?host=/cloudsql/project-name:us-east1:database-id