Cloud Run Fails to Connect to Cloud SQL (MySQL) via VPC Connector — Need Help with Network Debugging

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?

Hi @murilolivorato ,

Welcome to Google Cloud Community!

You might want to check out the Laravel on Cloud Run guide—it walks through the full setup of deploying Laravel to Cloud Run and connecting it to a Cloud SQL instance. It covers the key configuration details, like environment variables and service account permissions, so it’s a solid reference to make sure everything’s wired up right.

Also, I came across this helpful doc on how to log in to a Google Cloud Run container, which shows how to use tools like netcat for debugging. This might help you refine how you’re capturing and viewing connection test output—especially through Cloud Logging.

As for limitations on Cloud Run—there aren’t any known restrictions that would block what you’re trying to do. If your connector, permissions, and network routes are all configured correctly, Cloud Run should be able to reach your Cloud SQL instance just fine.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.