# UPSTREAM_TIMEOUT：连接到 VPC 连接器时请求超时。检查 VPC 连接器健康状况和子网容量。

- **ID:** `cloud/gcp-cloud-run-request-timeout-vpc-connector`
- **领域:** cloud
- **类别:** network_error
- **错误码:** `UPSTREAM_TIMEOUT`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

Cloud Run 服务的 VPC 连接器（Serverless VPC Access）的子网 IP 地址已耗尽或配置不足，导致连接超时。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| gcloud_cli | active | — | — |
| cloud_run | active | — | — |
| vpc_connector | active | — | — |

## 解决方案

1. ```
   Increase the VPC connector's subnet size: `gcloud compute networks vpc-access connectors update my-connector --region us-central1 --min-instances 2 --max-instances 10` (if using scalable connector) or create a new connector with a /28 subnet (16 IPs) instead of /29 (8 IPs).
   ```
2. ```
   Monitor VPC connector usage: `gcloud compute networks vpc-access connectors describe my-connector --region us-central1` and check `maxInstances` and `connectedProjects`. If near limits, deploy a second connector in a different subnet and route traffic via DNS.
   ```

## 无效尝试

- **** — The timeout is at the VPC connector level, not the application; increasing the Cloud Run timeout doesn't affect the connector's IP exhaustion. (85% 失败率)
- **** — More instances increase demand on the VPC connector, worsening IP exhaustion. (90% 失败率)
