【发布时间】:2019-07-30 07:46:27
【问题描述】:
根据https://cloud.google.com/functions/docs/writing/background
当您希望间接调用 Cloud Function 以响应事件(例如 Cloud Pub/Sub 主题上的消息、Cloud Storage 存储分区中的更改或 Firebase 事件)时,您可以使用后台函数。
函数参数为(data, context, callback):https://cloud.google.com/functions/docs/writing/background#function_parameters
然而,当我写一个像
这样的简单函数时exports = module.exports = functions.firestore
.document(path)
.onWrite((change, context, callback) => {
callback()
return
})
我收到一条错误提示
TypeError:回调不是函数
callback 不是 Firestore 后台功能的一部分吗?文档说是
如果没有,是否可以立即退出函数?
【问题讨论】:
标签: firebase google-cloud-firestore google-cloud-functions