0

I have a GCP MySQL database and a Cloud Run .net webAPI web service. They communicate via a VPC on GCP. This all worked fine. I cloned the database and updated my code in the web service to use the new connection name (exactly the same as the old one, just with "-benchmark" at the end. I have a connection test setup in GCP which runs successfully.

I have double checked and all permissions and settings on the SQL instance are the same.

Does anyone know what might have gone wrong with the cloning of the database?

To clarify, using the original database works fine, all I did was clone the DB and change the Server in the MySqlConnectionStringBuilder.Server to be the new DB instance connection name and I get the error MySqlConnector.MySqlException: (0x80004005): Cannot find Unix Socket at

russelrillema
  • 452
  • 7
  • 14

2 Answers2

1

Since new SQL instance will be used. Aside from updating the code to use the new connection, you should also explicitly update the cloud SQL connections of your cloud run.

Like any configuration change, setting a new configuration for the Cloud SQL connection leads to the creation of a new Cloud Run revision. Subsequent revisions will also automatically get this Cloud SQL connection unless you make explicit updates to change it

The only exception here is when you used Java to write you application, since you do this in the Java Cloud SQL Connector.

Michael C
  • 308
  • 1
  • 6
0

For anyone who runs into this in the future... I forgot to explicitly link the cloud run instance to the sql instance. This can be done by under the Edit and deploy new revision section in the Cloud Run instance, right at the bottom under Cloud SQL connections.

russelrillema
  • 452
  • 7
  • 14