我将此函数与 flutter 结合使用来触发对通知集合的写入。但到目前为止,更改用户请求集合中的任何内容都没有任何作用:
from firebase_admin import firestore, initialize_app
import google.cloud.firestore
from firebase_functions import firestore_fn, https_fn, db_fn
from firebase_functions.firestore_fn import (
on_document_created,
on_document_deleted,
on_document_updated,
on_document_written,
Event,
Change,
DocumentSnapshot,
)
initialize_app()
@https_fn.on_call(max_instances=10)
@on_document_updated(document="user_requests/{requestID}")
def paid_for_request(event: Event[Change[DocumentSnapshot]]) -> None:
firestore_client: google.cloud.firestore.Client = firestore.client()
firestore_client.document("notifications/test").set({
"body": "Hello"
})
如果您注意到我应该改变什么,请帮忙
您已将此云函数标记为
on_call
和 on_document_updated
。
删除
@https_fn.on_call()
,看看是否可以解决问题。