I'm trying to connect to a public IP CloudSQL Postgres database from a cloud function with Prisma. The database has SSL enforced. I assume I can use the Cloud Auth Proxy, and it works locally, but when I deploy it gives me an error.
I've tried both:
Option 1:
datasource db {
provider = "postgresql"
url = "postgresql://USER:PASSWORD@localhost:3307/DATABASE_NAME?host=CONNECTION_URL"
}
Got error:
Can't reach database server at `CONNECTION_URL`:`3307`
Option 2:
datasource db {
provider = "postgresql"
url = "postgresql://USER:PASSWORD@localhost/DATABASE_NAME?host=CONNECTION_URL"
}
Got error:
Can't reach database server at `IP_ADDRESS`:`5432`
Where IP_ADDRESS is the correct public IP address for the database that I can see in the console
CONNECTION_URL is /cloudsql/PROJ:REGION:INSTANCE