Something is wrong with my external connection, everything was working fine until 2 weeks ago this error started appearing and we didn’t changed anything… this is the query I used like a test:
SELECT 1 FROM EXTERNAL_QUERY(PII Removed by Staff), “SELECT 1;”);
Error: Invalid table-valued function EXTERNAL_QUERY Failed to connect to MySQL database. Error: MysqlErrorCode(2013): Lost connection to MySQL server during query For more information, see https://cloud.google.com/bigquery/docs/cloud-sql-federated-queries#troubleshooting at [1:15]
I am new to GCP and I was not the one that created the connection originally but still know a few things:
I don’t know what else I can check… thank you very much for your time
The error indicates that BigQuery’s EXTERNAL_QUERY is losing connection to your Cloud SQL MySQL instance. Since it was working before, this is likely due to network or SSL changes, Cloud SQL maintenance, or user permission issues. Check that the Cloud SQL instance is still running, publicly accessible (if using public IP), and that the user/SSL credentials used by the connection haven’t expired. Also verify that the BigQuery connection’s region matches the Cloud SQL instance and that no firewall or VPC changes have blocked traffic. Recreating the connection in BigQuery often resolves lingering connection issues.
I recreated the connection but at the moment of trying the connection in a query same error pops up. The user that we use to create the connection can be used directly in the cloud sql and have no issues with other resources we use, so I guess credentials are up to date. Our IP is private, and we can not change it. Our region matches, so that is not the problem. We haven’t changed nothing on the firewall, as I said before, it suddenly stopped working. And just to add… permission like “Cloud SQL Client”, are added so it “should” work.
Now is working, it looks like the “Private path for Google Cloud services” turned off unexpected… I leave this here in case anyone with same problem can find this solutions useful.