Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Function times out connecting to Cloud SQL - All standard methods failed

Hello, I have a new project (financialnews-463800) and am unable to establish a database connection between a 2nd Generation Cloud Function (python312 runtime in asia-southeast1) and a Cloud SQL PostgreSQL instance in the same project and region. I have attempted and documented failures for both standard connection methods:

  1. Private IP Method: When deploying a function that uses the google-cloud-sql-connector[pg8000] library, the Cloud Build process fails with the error No matching distribution found.
  1. Public IP Method: When deploying a function that connects to the database's Public IP (with the firewall authorized for 0.0.0.0/0), the function times out with a 504 Gateway Timeout. A diagnostic test proves the function can make other outbound HTTPS requests successfully, isolating the timeout to the database connection call.

Could you please advise on any potential networking policies or project settings that would prevent both of these standard connection methods from working?

0 0 17
0 REPLIES 0