# Error: SQL Server connection timeout after 30 seconds using Cloud SQL Proxy with SSL

- **ID:** `cloud/gcp-cloud-sql-connection-timeout-ssl`
- **Domain:** cloud
- **Category:** network_error
- **Error Code:** `CLOUD_SQL_CONNECTION_TIMEOUT`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Cloud SQL Proxy with SSL enabled can cause connection timeouts when the proxy's SSL handshake is misconfigured or the instance's SSL certificate is not properly trusted, leading to a 30-second default connection timeout.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Cloud SQL Proxy 2.8.0 | active | — | — |
| Cloud SQL for SQL Server 2022 | active | — | — |
| gcloud CLI 450.0.0 | active | — | — |

## Workarounds

1. **Update the Cloud SQL Proxy to the latest version (e.g., 2.9.0+) and ensure the SSL certificate chain is correctly configured: download the server CA certificate from the GCP Console and pass it via --ssl-ca-path.** (85% success)
   ```
   Update the Cloud SQL Proxy to the latest version (e.g., 2.9.0+) and ensure the SSL certificate chain is correctly configured: download the server CA certificate from the GCP Console and pass it via --ssl-ca-path.
   ```
2. **Use the Cloud SQL Auth Proxy with the --auto-iam-authn flag to bypass SSL certificate issues when IAM authentication is enabled.** (75% success)
   ```
   Use the Cloud SQL Auth Proxy with the --auto-iam-authn flag to bypass SSL certificate issues when IAM authentication is enabled.
   ```
3. **Example command: cloud-sql-proxy --ssl-ca-path=/path/to/server-ca.pem INSTANCE_CONNECTION_NAME** (80% success)
   ```
   Example command: cloud-sql-proxy --ssl-ca-path=/path/to/server-ca.pem INSTANCE_CONNECTION_NAME
   ```

## Dead Ends

- **** — The timeout is a symptom, not the root cause; the SSL handshake still fails. (70% fail)
- **** — SSL is often required by compliance; disabling it is not a viable fix. (50% fail)
