Firebase函数返回连接错误

时间:2018-12-20 13:27:52

标签: node.js firebase firebase-realtime-database google-cloud-functions

我正在使用Firebase函数数据库触发器。

我的功能:

exports.function_name = functions.database
  .ref("/transact/{entry_type}/{id1}/{id2}/trigger_cross_entry_function")
  .onCreate((data, context) => {
    console.log("trigger_cross_entry_function value", data.val());

    if (data.val() == true) {

      console.log("Function Calling parent data");

      return data.ref.parent.once('value').then(function(snapshot){


      }, function(error) {
        // The Promise was rejected.
        console.error("THIS IS THE ERROR:"+error);
      });

    } else {
      console.log("Function Returned");
      return 0;
    }
 });

每当我想触发此功能时,我都会将trigger_cross_entry_function放入来自移动应用程序的特定路径。一切正常,并按预期方式调用了功能。

一段时间后,如果我再次尝试做同样的事情,它会给我

Function execution took 16 ms, finished with status: 'connection error'

如果重新启动该功能,它将再次完美运行。 并且如果我连续触发它,那就没问题了。

但是一旦我让它闲置并尝试触发它 一段时间后再次出现此错误。

而且我正在使用Firebase Pay as go计划。

此外,如您所见,我正确地返回了所有的Promise,并且每次都触发函数,但是它没有进入函数。它只是退出并出现连接错误。

这可能是什么原因?我花了一天的时间找到这个。

1 个答案:

答案 0 :(得分:1)

遇到相同的问题。看起来Google更改了服务状态为down https://status.firebase.google.com/incident/Functions/18046 https://status.firebase.google.com/

最有可能是Google方面的问题。