firestore cloud functions onCreate/onDelete sometimes immediately triggered twice

后端 未结 3 1155
再見小時候
再見小時候 2020-12-05 16:27

I have observed this behavior occasionally with both onCreate and onDelete triggers.

Both the executions happened for the same document created in firestore. There

3条回答
  •  日久生厌
    2020-12-05 17:00

    See the Cloud Firestore Triggers Limitations and Guarantees:

    Delivery of function invocations is not currently guaranteed. As the Cloud Firestore and Cloud Functions integration improves, we plan to guarantee "at least once" delivery. However, this may not always be the case during beta. This may also result in multiple invocations for a single event, so for the highest quality functions ensure that the functions are written to be idempotent.

    There is a Firecast video with tips for implementing idempotence.

    Also two Google Blog posts: the first, the second.

提交回复
热议问题