Firestore cloud functions not triggered when deplo

2019-08-05 01:46发布

问题:

I created a google cloud source repository and added the following in main.py (in my root directory)

def sample_function(event, context):
    print('inside sample_function')
    return True

I deployed the function using the following command:

 $ gcloud beta functions deploy sample_function \
   --entry-point sample_function \
   --runtime python37 \
   --source https://source.developers.google.com/projects/project_id/repos/repository_id/moveable-aliases/my_branch_name \
   --region europe-west1 \
   --trigger-event providers/cloud.firestore/eventTypes/document.create \
   --timeout 60s \
   --trigger-resource projects/my_project_id/databases/default/documents/finalDb/{orgId}/tasks/{taskId}

The function was deployed successfully as shown:

But the cloud function is not triggered when a document is added at the specified trigger path.I checked the cloud function logs and there was no entry in the log to showcase that the function executed.

What could be the issue? Am I missing something during deployment?

P.S I wrote the similar functions using the inline editor and they seem to work fine

回答1:

Firebase-specific triggers (including Firestore) are currently not supported for python and gcloud.

EDIT

gcloud now has support for writing and deploying Firestore triggers in all supported languages.