我正在使用此处记录的 Cloud Firestore 触发器。 https://firebase.google.com/docs/functions/firestore-events
如何从这些函数之一运行异步代码?这是我想做的一个例子。
async function doSomething(data) {
// ...
}
exports.updateUser = functions.firestore
.document('users/{userId}')
.onUpdate((change, context) => {
await doSomething(change.after.data());
});
当我尝试部署此功能时,我收到此错误消息。
return await doSomething(change.after.data());
^^^^^
SyntaxError: await is only valid in async function
慕码人8056858
相关分类