Hello!
I followed every step in the tutorial "Connect to Cloud SQL for PostgreSQL from Cloud Functions" for a Private IP.
https://cloud.google.com/sql/docs/postgres/connect-instance-cloud-functions
At the end of the tutorial, when I click the URL under the function details, I get the following error:
I've redone the tutorial several times, following each step exactly, and I keep getting the error.
What should I do? I'm not sure why it's trying to connect to a public IP when I set it for a private IP.
Happy to share any more information that would be relevant.
The error message cloudsqlconnectorerror cannot connect to instance, public Ip address not found
indicates that your Cloud Function is trying to connect to your Cloud SQL instance using a public IP address, but your instance does not have a public IP address. This is likely because your Cloud SQL instance is configured to only allow connections from private IP addresses.
To fix this, ensure your Cloud Function is configured to connect to your Cloud SQL instance using a private IP address. Follow these steps:
PROJECT_ID:REGION:INSTANCE_ID
.@Google-cloud/cloud-sql-connector
library for connecting to the Cloud SQL instance.If you are still having trouble connecting to your Cloud SQL instance, please contact Google Cloud support for assistance.