You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Cloud Run部署报错:api_endpoint_overrides/run属性值无效求助

问题原因

报错的核心是**--region参数值末尾多了一个空格**。你的cloudbuild.yaml里,--region对应的取值是'us-central1 '(注意末尾的空格),gcloud run deploy命令解析这个参数时,会把带空格的region值错误拼接到API endpoint中,生成格式违规的https://us-central1 - run.googleapis.com/(中间出现多余空格),不符合endpoint必须是无空格、以http://或https://开头且以/结尾的绝对URI要求。

解决方法

修改cloudbuild.yaml部署步骤里的--region参数,去掉值末尾的空格:

steps:
 # Build the container image
 - name: 'gcr.io/cloud-builders/docker'
   args: ['build', '-t', 'gcr.io/$PROJECT_ID/app2:$COMMIT_SHA', '.']
 # Push the container image to Container Registry
 - name: 'gcr.io/cloud-builders/docker'
   args: ['push', 'gcr.io/$PROJECT_ID/app2:$COMMIT_SHA']
 # Deploy container image to Cloud Run
 - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
   entrypoint: gcloud
   args:
   - 'run'
   - 'deploy'
   - 'app2'
   - '--image'
   - 'gcr.io/$PROJECT_ID/app2:$COMMIT_SHA'
   - '--region'
   - 'us-central1'  # 移除末尾空格
 images:
 - 'gcr.io/$PROJECT_ID/app2:$COMMIT_SHA'
 options:
  logging: CLOUD_LOGGING_ONLY

修改后重新触发CI/CD流水线,部署步骤就能正确解析region参数,生成合法的API endpoint,完成部署。

内容的提问来源于stack exchange,提问作者Debu Shinobi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 22:45:28