云功能失败,消息"Error: function crashed out of request scope"



我无法让最简单的Firebase Cloud Function正确执行。下面的代码不会生成任何控制台日志记录,但错误除外:Error: function crashed out of request scopeFunction invocation was interrupted.

exports.testFunction = functions.firestore.document('trigger/dummy2').onUpdate(async (change : any, context : any) => {
console.log( "How can this fail?" );
});

从文档中看并不明显(至少对我来说(,但返回 Promise 需要async函数。如果这是一个不相关的要求,您可以返回已解决的承诺。

exports.testFunction = functions.firestore.document('trigger/dummy2').onUpdate(async (change : any, context : any) => {
console.log( "How can this fail?" );
return Promise.resolve(100);
});

最新更新