Not able to create cloud function trigger on bucket which is under other project.
Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.functions.deploy) OperationError: code=7, message=Insufficient permissions to (re)configure a trigger (permission denied for bucket ing-auto). Please, give owner permissions to the editor role of the bucket and try again.
For service account used in cloud function has owner access to the project where bucket lies.
i.e there are two project project-a and project-b. cloud function need to be created in project-a. google bucket is in project-b. service account user serv-user is part of project-a and has owner access of project-b which will be used to execute cloud function.
gcloud functions deploy hello_gcs --runtime python37 --trigger-resource bucket-from-other-project-xxx --trigger-event goog
le.storage.object.finalize
I am able to create cloud function storage trigger on buckets of same project
It is not possible. Quoting the Google Cloud Functions documentation:
Cloud Functions can only be triggered by Cloud Storage buckets in the same Google Cloud Platform project.
As a possible workaround you can deploy your Cloud Function as HTTP triggered. Then, in the project where the bucket belongs to, deploy another Cloud Function triggered by the Cloud Storage event and in its code make an HTTP call to trigger the first Cloud Function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With