Firestore:错误:4 DEADLINE_EXCEEDED:超过了截止日期

时间:2020-01-11 17:09:46

标签: firebase aws-lambda google-cloud-firestore grpc

我要查询的Firebase集合实际上是空的。内部零文档。即使那样,在查询时,我也会收到此错误

我正在AWS的LAMBDA函数中执行此操作。我知道查询有效,因为它有时确实返回结果,但是它是非常随机的。通常只是出现了这个错误

以下是我的Lambda日志,其中启用了以下ENV变量 GRPC_TRACE =全部 GRPC_VERBOSITY = DEBUG

My Lambda Logs

我什至尝试了此操作,因为我在某处在线找到了它,但没有任何作用

db.settings({
  clientConfig: {
    interfaces: {
      'google.firestore.v1.Firestore': {
          methods: {
            RunQuery: {
              timeout_millis: 5 * 60 * 1000
            }
          }
        }
      }
    }
});

这是我的查询代码的样子

let snap = await db.collection('notifications').where("siteID", "==", msg.siteId).where("procCode", "==", code).where("aptNum", "==", msg.affectedRows[0].after.AptNum).get();

这是我最终得到的输出。甚至不是在同一lambda执行中,而是在单独的lambda执行中,这也很奇怪。

enter image description here

1 个答案:

答案 0 :(得分:7)

我弄清楚我的问题在这里。我在异步函数中调用Firebase API,但是该函数的调用者并未“等待”导致该问题的调用。现在一切正常。