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

通过Cloud Source Repositories部署GCF失败:无法获取源码求助

GCP Functions Deploy Fails with "Failed to Retrieve Function Source Code" When Using Cloud Source Repository URL

Problem Statement

I successfully deployed a GCP Function using this command prior to December 4th, but when I ran it on December 27th, it failed outright:

gcloud beta functions deploy pipeline-helper --set-env-vars PROPFILE_BUCKET=${my_bucket},PROPFILE_PATH=${some_property} --source https://source.developers.google.com/projects/{PROJECT}/repos/{REPO}/fixed-aliases/1.0.1/paths/ --entry-point onFlagFileCreation --runtime nodejs6 --trigger-resource ${my_bucket} --trigger-event google.storage.object.finalize --region europe-west1 --memory 1G --timeout 300s

The deployment works flawlessly when using a GCS bucket or local directory as the --source target, but consistently fails when pointing to a Cloud Source Repository (CSR) URL.

Error Output (With Debug Flag Enabled)

Deploying function (may take a while - up to 2 minutes)... ..failed.
DEBUG: (gcloud.beta.functions.deploy) OperationError: code=13, message=Failed to retrieve function source code
[Full Traceback omitted]
ERROR: (gcloud.beta.functions.deploy) OperationError: code=13, message=Failed to retrieve function source code
Build step 'Execute shell' marked build as failure
Finished: FAILURE

Troubleshooting Steps I've Tried

  • Tested with the minimal valid CSR URL as specified in official docs: https://source.developers.google.com/projects/PROJECT/repos/REPO — same error persisted
  • Cloned the official Google Cloud Functions - Hello World sample into my CSR and attempted deployment with an equivalent command — still failed
  • Verified deployment works perfectly when using a GCS bucket (with a zip package) or local repository as the source

Service Account Permissions

The service account xxx-compute@developer.gserviceaccount.com used for deployment has the following roles:

  • Stackdriver Debugger Agent
  • Cloud Functions Developer
  • Cloud Functions Service Agent
  • Editor
  • Service Account User
  • Source Repository Writer
  • Cloud Source Repositories Service Agent
  • Storage Object Creator
  • Storage Object Viewer

I'm stuck on this issue and would really appreciate any guidance or solutions from the community.


内容的提问来源于stack exchange,提问作者Brahim A.

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.11 08:31:32