有没有办法停止firebase云函数的运行实例——它进入了无限循环

Chi*_*lan 1 firebase google-cloud-functions

我有一个云函数,它有一些这样的代码:

exports.functionName = functions.https.onCall((data, context) => {
    //some logic
    b().then(function(otherData){
       //further logic
       resolve(otherDataModified)
    });
});

b = () => {
    if(someError){
      b();
      resolve(); //This is where i made the mistake, this should be returned after b has completed
    }else{
      resolve();
    }
}
Run Code Online (Sandbox Code Playgroud)

现在的问题是,在意识到错误之前我已经两次调用了这个函数,这导致函数 b 进入无限循环,虽然请求已经完成并解决了,我向用户显示了错误,但有两个函数是不断运行到后台,我看不到实际停止执行此操作的选项。

还尝试用正确的逻辑更新函数,新的运行都正常工作,但这次运行完全挂断,如果不检查会导致我产生大量资源计费。

在此处输入图片说明

在此处输入图片说明

Ren*_*nec 8

您应该通过以下位置的 Google Cloud 控制台(而不是 Firebase 控制台)删除 Cloud Functions 函数:

https://console.cloud.google.com/functions/list?project=YOUR_PROJECT_NAME

您将看到一个表格,其中列出了您部署的 Cloud Functions:在每行的末尾,您会找到一个三点按钮。单击此按钮并选择“删除”。