Triggers do not work if deployed via google gcloud

I want to deploy via gcloud
But when I deploy, the trigger is triggered but there is no data about the document
If I deploy through firebase, everything works fine

Visually everything looks the same

Can you tell me what it could be?


Trigger:

 

exports.onUserUpdate = onDocumentUpdated("users/{id}", async (event) => {
    console.log(`event.params: ${event.params}`);
    console.log(`event.database: ${event.database}`)
    console.log(`event.document: ${event.document}`)
    console.log(`event.namespace: ${event.namespace}`)
    console.log(`event.data: ${event.toString()}`);
});

 

Screenshot 2023-10-23 at 23.17.55.png

cloudbuild.yml

 

steps:  
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
  args:
  - gcloud
  - beta
  - functions
  - deploy
  - userTriggers-onUserUpdate
  - --gen2
  - --cpu=1
  - --concurrency=20
  - --region=us-central1
  - --source=functions
  - --entry-point=userTriggers.onUserUpdate
  - --trigger-location=eur3
  - --trigger-event-filters=type=google.cloud.firestore.document.v1.updated
  - --trigger-event-filters=namespace=(default)
  - --trigger-event-filters=database=(default)
  - --trigger-event-filters-path-pattern=document=users/{id}
  - --runtime=nodejs18
  - --min-instances=1
  - --memory=256M
  - --allow-unauthenticated

 

 

0 1 448
1 REPLY 1

Greetings @SergeyBarbirosh!

Welcome to the Google Cloud Community!

Take a look into this documentation: Eventarc Triggers.

You can specify an Eventarc trigger when you deploy a function. Checkout deploying a Cloud Function for a background. In the deployment through gcloud you can refer to the code below in using Eventarc triggers:

gcloud functions deploy YOUR_FUNCTION_NAME \
--gen2 \
--trigger-event-filters=EVENTARC_EVENT_FILTERS \
[--trigger-event-filters-path-pattern=EVENTARC_EVENT_PATH_PATTERN] \
[--trigger-location=EVENTARC_TRIGGER_LOCATION] \
[--trigger-service-account=EVENTARC_TRIGGER_SERVICE_ACCOUNT] \
[--retry] \
...

Also, make sure if you should be using Cloudbuild.yaml because this is used in Cloud Build and not in deployment in gcloud. If you're using Cloudbuild.yaml, make sure that you are following it's structure.

If the above options don't work, you can contact Google Cloud Support to further look into your case. Let me know if it helped, thanks!