I’m deploying a Laravel application to Google Cloud Run and encountering issues when trying to connect to a Cloud SQL (MySQL) instance via a VPC connector. I’ve gone through several troubleshooting steps but haven’t been able to resolve the problem.
Setup:
Cloud SQL (MySQL) instance running with a private IP in the same VPC network.
Cloud Run service configured with a VPC connector.
VPC connector is in the same region as the Cloud Run service.
VPC egress is set to “all-traffic”.
Cloud SQL Private IP: 10.33.0.3, Port: 3306.
What I’ve Tried:
VPC Configuration:
Confirmed VPC connector is properly configured.
Verified that the connector has access to the same VPC where Cloud SQL is located.
Ensured VPC connector and Cloud Run service are in the same region.
Network Testing:
Built a custom Docker image with netcat for network testing.
Pushed the image to Artifact Registry.
Created a Cloud Run job with the following configuration:
Image: us-central1-docker.pkg.dev/curso-gcp-420816/finance/network-debugger
Command: nc -zv -w 15 10.33.0.3 3306
VPC Connector: finance-vpc-connector
VPC Egress: all-traffic
The job executes successfully and completes, but I can’t seem to retrieve the actual result of the connection test from the logs.
Additional Context:
This is a Laravel application.
The database connection was working previously.
Credentials and connection strings have been verified.
The Cloud SQL instance is up and accessible from other services.
Questions:
How can I reliably capture and view the output from netcat or similar tools when running Cloud Run jobs?
Are there known limitations with logging in Cloud Run jobs that could explain why I’m not seeing the connection test output?
Are there additional network troubleshooting steps you’d recommend for this scenario?
Are there specific VPC, firewall, or IAM configurations that I should double-check in this setup?