Reputation: 725
I am trying to deploy a Cloud Storage trigger by following the guide here: https://cloud.google.com/functions/docs/tutorials/storage#object_finalize
I want to listen for any finalization in my default "us multi-region" bucket. Unfortunately, when I try to deploy the function trigger via gcloud cli as described in the link above:
gcloud functions deploy **** \
--gen2 \
--region=us-central1 \
--project=**** \
--trigger-event-filters="type=google.cloud.storage.object.v1.finalized" \
--trigger-event-filters="bucket={my-multi-region-bucket}"
I get the following error:
INVALID_ARGUMENT: Cannot create trigger ****:
Bucket '****' is in location 'us', but the trigger location is 'us-central1'.
The trigger must be in the same location as the bucket.
Try redeploying and changing the trigger location to 'us'.
Upvotes: 6
Views: 1715
Reputation: 725
I finally got it working by simply adding the --trigger-location=us
as shown below:
gcloud functions deploy **** \
--gen2 \
--region=us-central1 \
--project=**** \
--trigger-event-filters="type=google.cloud.storage.object.v1.finalized" \
--trigger-event-filters="bucket={my-multi-region-bucket}" \
--trigger-location=us
Upvotes: 16