postgresql-dart icon indicating copy to clipboard operation
postgresql-dart copied to clipboard

How to connect from dart server cloud run to Cloud SQL (Postgresql)

Open nurbek-b opened this issue 2 years ago • 5 comments

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?

nurbek-b avatar Jul 14 '22 07:07 nurbek-b

I'm not sure, but this may be a related issue: #19

isoos avatar Jul 15 '22 05:07 isoos

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

rxlabz avatar Sep 02 '22 11:09 rxlabz

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

ookami-kb avatar Jan 06 '24 20:01 ookami-kb

Note: we had a slightly different socket handling with the v3 release, maybe it got better with that?

isoos avatar Jan 06 '24 20:01 isoos

Yeah, I'm using 3.0.5 version.

ookami-kb avatar Jan 06 '24 20:01 ookami-kb

I am assuming we don't have more actionable item here.

isoos avatar Sep 06 '24 21:09 isoos