Trouble connecting Cloud Run application to Cloud SQL database

I’m having issues linking my Cloud Run app to a Cloud SQL database. I tried following the official guide, but I’m getting an error message about a TLS handshake failure. The error mentions something about a certificate CN mismatch.

My connection string looks like this:

postgresql://postgres:mypassword@localhost/postgres?host=/cloudsql/myproject:myregion:myinstance

I’ve double-checked everything, but I can’t figure out what’s wrong. Has anyone encountered this before? Any tips on how to fix it? I’m pretty new to Cloud Run and Cloud SQL, so I might be missing something obvious.

Thanks in advance for any help!

hey there! i had similar issues before. make sure ur using the correct instance connection name in the host part. also, check if the service account has proper permissions. sometimes redeploying the app helps too. good luck!

hm, interesting issue! have u tried using the Cloud SQL Auth proxy? it can help bypass some connection probs. Also, double-check ur firewall rules - sometimes they can be sneaky culprits. What kinda app are u building? maybe theres a specific quirk related to ur use case?