Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firestore: Error: 4 DEADLINE_EXCEEDED: Deadline exceeded

My firebase collection that I'm trying to query is literally empty. Zero documents inside. Even then, when querying it, I'm getting this error

I'm doing this inside a LAMBDA function on AWS. I know that the query works because it does return results sometimes but it's very random. Mostly it's just coming up with this error

Here are my lambda logs with following ENV variables turned on GRPC_TRACE=all GRPC_VERBOSITY=DEBUG

My Lambda Logs

I have even tried this as I found this online somewhere but it didn't make any difference

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

Here's what my query code looks like

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

Here's the output I get eventually. Not even in the same lambda execution but in a separate one which is also strange.

enter image description here

like image 602
Saumil Shah Avatar asked Jan 11 '20 17:01

Saumil Shah


1 Answers

I figured out what my issue was here. I was calling the Firebase API inside an async function but the caller of that function wasn't "await"ing that call which led to this. It all works now.

like image 82
Saumil Shah Avatar answered Nov 15 '22 10:11

Saumil Shah