postgresql-dart
postgresql-dart copied to clipboard
How to connect from dart server cloud run to Cloud SQL (Postgresql)
I need a help. How can I connect to Cloud SQL (Postgresql) from image which is in Cloud Run. I tried to use isUnixSocket: true
, but unfortunately it did not help. Also tried to use as a host public IP, outgoingIP, connection name. Has any one face such issue?
I'm not sure, but this may be a related issue: #19
Hi @nurbek-b ,
I've just found the answer in https://cloud.google.com/sql/docs/postgres/connect-run#connect_to : you need to add /.s.PGSQL.5432
at the end of the host, ex: /cloudsql/project:region:database/.s.PGSQL.5432
For someone like me wasting several hours on that – don't forget to also enable Gen 2 environment on Cloud Run instance. More on that here: https://github.com/dart-lang/sdk/issues/47899#issuecomment-1076598577
Note: we had a slightly different socket handling with the v3 release, maybe it got better with that?
Yeah, I'm using 3.0.5 version.
I am assuming we don't have more actionable item here.