Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

gcloud funcitons deploy not set --trigger-resource correctly

I run this command to deploy my function:

gcloud functions deploy nameOfFunction --trigger-event="providers/cloud.firestore/eventTypes/document.create" --trigger-resource="projects/project-name/databases/database-name/documents/messages/{uid}" --runtime=nodejs16 --region=europe-west1 --project=project-name

The command running correctly but when view configuration on google cloud dashboard the trigger resource is empty (this is a required field).

0 2 322
2 REPLIES 2

Hi @matteo_padovano,

Welcome to Google Cloud Community!

If the trigger resource is not being set correctly when deploying a Cloud Function with the gcloud functions deploy command, you should ensure that the value provided to the --trigger-resource flag is correct and in the format //cloud.firestore/{documentPath}. Also, make sure that any wildcards in the path, such as {uid}, are being replaced with the correct value when the function is triggered.

If the issue persists, you can try deploying the function without the --trigger-resource flag and setting the trigger resource manually in the Cloud Functions configuration on the Google Cloud dashboard.

For more information on deploying Cloud Functions, including setting trigger resources, see the Google Cloud documentation on Deploying Cloud Functions from the command line.

Thanks

 

Hi @christianpaula,

options --trigger-resource is required when deploy a function with options --trigger-event.
I have used the same command many times and all worked great.
At the moment after deploy, go to function panel and set the trigger resource manual.