【发布时间】:2020-06-07 06:40:26
【问题描述】:
我一直在将这个代码结构与 httprequest 云函数一起使用。它适用于那些 httprequest 函数,但现在我得到“函数返回未定义的预期承诺或值”错误,即使我返回“成功!?”。
你知道我哪里错了吗?我是 onWrite 触发器和整个云函数世界的新手...
这是我的代码:
export const toDashboardInfo = functions.firestore.document('maps/{mapId}').onWrite((change, context) => {
const doWork = async function()
{
//do stuff here with await
return("Success!?");
}
doWork().then((returnData) =>
{
return(returnData);
}).catch((error) => { return(error)})
});
谢谢!
【问题讨论】:
标签: typescript firebase async-await google-cloud-functions