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

求助修正Cloud Build部署Cloud Function的cloudbuild.yaml参数错误

Fixing Cloud Build Deployment Error for Cloud Function Triggered by Storage Bucket Change

Looks like you ran into a classic mix-up between your intended bucket name and what you actually wrote in the config—plus a tiny parameter formatting check. Let's break this down and fix your cloudbuild.yaml right away.

The Core Issue

Your error messages reference hjemmeside as the bucket name, but you explicitly stated your trigger bucket is named homepage. That misspelling is the primary culprit here—GCP can't recognize a bucket that doesn't match what exists in your project, so it throws that confusing "unrecognized arguments" error.

Corrected Configuration Options

Option 1: Simplified Trigger with --trigger-bucket

This is the quickest way to bind your function to bucket uploads (it defaults to the google.storage.object.finalize event):

steps:
- name: 'gcr.io/cloud-builders/gcloud'
  args:
  - functions
  - deploy
  - pupetter-e2e
  - --source=. 
  - --trigger-bucket=homepage

Alternatively, you can split the parameter and value into separate args elements (both formats work):

steps:
- name: 'gcr.io/cloud-builders/gcloud'
  args:
  - functions
  - deploy
  - pupetter-e2e
  - --source=. 
  - --trigger-bucket
  - homepage

Option 2: Explicit Event Trigger with --trigger-resource & --trigger-event

If you need to specify a different storage event (like object deletion or metadata updates), use this full configuration—just make sure the bucket name is correct:

steps:
- name: 'gcr.io/cloud-builders/gcloud'
  args:
  - functions
  - deploy
  - pupetter-e2e
  - --source=. 
  - --trigger-resource=homepage
  - --trigger-event=google.storage.object.finalize

You can replace google.storage.object.finalize with other valid storage events (e.g., google.storage.object.delete, google.storage.object.metadataUpdate) based on your needs.

Quick Pre-Deployment Checks

  1. Verify the bucket homepage exists in your GCP project (run gsutil ls to list buckets).
  2. Ensure your Cloud Build service account has the necessary permissions: at minimum, roles/cloudfunctions.developer and roles/storage.admin (or more granular permissions if you prefer).
  3. Test the command locally first to rule out other issues:
    gcloud functions deploy pupetter-e2e --source=. --trigger-bucket homepage
    

If this local command works, your Cloud Build config will too.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.11 08:14:45