ASAD HAMEED
ASAD HAMEED

Reputation: 2900

Firebase Cloud Functions: "4 DEADLINE_EXCEEDED: Deadline exceeded"

We're getting this error when trying to add data to firestore using cloud functions.

We're getting data from an API and it works fine, but on adding the data to firestore it produces this error,

Error detected in fetchInventory {"exceptionInfo":{"type":"Error","message":"4 DEADLINE_EXCEEDED: Deadline exceeded"},"@type":"type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.Insight","errorGroup":"CJ69k8PhgvTNKQ","errorEvent":{"serviceContext":{"resourceType":"cloud_function","service":"fetchInventory"},"message":"Error: 4 DEADLINE_EXCEEDED: Deadline exceeded\n    at Object.callErrorFromStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call.js:31:26)\n    at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client.js:179:52)\n    at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141)\n    at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)\n    at /workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78\n    at processTicksAndRejections (internal/process/task_queues.js:79:11)","eventTime":"2021-05-23T10:11:12.748Z"}}

We're writing around 900 documents in firestore.

A detailed explanation of the issue would help a lot :)

Upvotes: 3

Views: 8073

Answers (1)

Tarik Huber
Tarik Huber

Reputation: 7418

That error can be caused by writing to much data to firestore at once. The error also apperas sometimes on bad internet connections or bugs in the code.

Try to reduce your write to not more than 500 elements or even less. If that doesn't help check if you have a slow connection. If you still see that error I would ask you to share some of your code so we can check that to.

enter image description here

Yout can find more about the limits here.

Upvotes: 3

Related Questions