我正在使用此處記錄的 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
如何在 Cloud Firestore 觸發器中運行異步代碼
慕桂英546537
2023-04-01 17:29:29