Cloud Storage object finalize event not triggering gen2 function

I recently deployed some previously gen1 functions to gen2, and I note that one of my functions that subscribes to the google.cloud.storage.object.v1.finalized event is not triggering when objects are uploaded to the bucket.

I deploy my gen2 functions using gcloud, and the command looks something like this:

gcloud functions deploy "exampleFn" \
  --quiet \
  --gen2 \
  --entry-point="exampleFn" \
  --project="..." \
  --region="europe-west1" \
  --runtime="nodejs22" \
  --timeout="540s" \
  --memory="2048Mi" \
  --ingress-settings="internal-only" \
  --trigger-resource="example-bucket" \
  --trigger-location="eu" \
  --trigger-event="google.cloud.storage.object.v1.finalized" \
  --service-account="...@....iam.gserviceaccount.com" \
  --update-labels="..." \
  --source="..." \
  --env-vars-file="..."

It seems the Eventarc trigger was created in relation to the above command, but I cannot for the life of me trigger the event when I upload files to the bucket.

The bucket resides in eu and the trigger location was set to eu — the function itself is in europe-west1, so I’m unsure if that’s an issue.

I also set ingress-settings to internal-only, so maybe that’s my problem, however I figured it should have worked considering it is Google turtles all the way down.

Seems like the issue was that my Cloud Run function service account did not have the roles/eventarc.eventReceiver role attached. Which is a bit weird, as I had a custom role that had the permissions from this role already added :person_shrugging:

Edit: actually my issue was that I wasn’t using the correct event: it should have been google.storage.object.finalize when using gcloud functions deploy --trigger-event. Using gcloud functions event-types list clarified which acceptable events I could use.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.