I am trying to connect my cloud run app to cloud sql, here is my cloudbuild.yaml
steps:
- name: 'gcr.io/cloud-builders/npm'
env:
- DATABASE_URL=$_DATABASE_URL
entrypoint: npx
dir: './server'
args:
- 'prisma'
- 'migrate'
- 'deploy'
However, I keep on getting the error Please make sure your database server is running at '/cloudsql/learninfra001:us-central1:learninfra001-postgres':'5432'.
Here is the _DATABASE_URL I use for substitution variable postgresql://postgres:password@localhost/db?schema=public&host=/cloudsql/learninfra001:us-central1:learninfra001-postgres
I have made sure the following:
db is createdUsing white-listed public IP, I am able to connect to the DB. However, I just can't seem to get cloud run to work. Is there anything else I could check? Or is there a way to get more logging to see why it is not connecting?
In short, you'll need to enable a Cloud SQL connection to your Cloud SQL instance from Cloud Build.
See https://cloud.google.com/sql/docs/mysql/connect-build for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With