You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 4, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 4, 2026. It is now read-only.
Bandwidth Exhausted while doing Firestore calls through NodeJS Server deployed on Google App Engine. #765
While doing query request on firestore, sometime we get the error mentioned below and all the calls to firestore after that starts giving the same error. After another deployment with no changes all the apis works fine. I am still unable to figure out the leading cause of this error.
@zulqarnainhanif Thanks for filing this issue and sorry to hear about your troubles. We have seen other reports internally and believe that the underlying issue is a RESOURCE_EXHAUSTED error from the backend. To debug your case, we will likely need project specific information, which will help us look at the workload at the time you experienced this error.
I am re-opening this for now as @mikelehen tracked down an internal root cause for these error messages. The error seems to only reproduce with Node v10.16.3 and v12.11.0 and is likely caused by nodejs/node#29223
You can work around this by downgrading the network layer for Firestore to an implementation that does not rely on Node's HTTP/2 network stack. This can be done as such:
@zulqarnainhanif We were able to confirm that nodejs/node#29223 is indeed the root cause. We hope to get this fixed in the underlying Node implementation soon.
@ryansydnorfirestore.settings({grpc}) bypasses this problem by using a different HTTP/2 stack.
When you can switch to one of the Node version ranges mentioned above (Node 10.18.1+, Node 12.3.2+ and Node 12.4.1+), then you can switch back to the main GRPC stack. This should again reduce your binary size and startup time.
Do note that Node's version ranges are distinct and that the bug is addressed individually in each version - i.e. the fix in 10.1.8.1 is not part of Node 11.x or Node 12.0.
Experiencing a similar issue when performing some reasonably light stress testing on my API which interacts with Firestore using "firebase-admin": "^8.12.0" (NodeJS).
Performing a stress test which replicates 600 users sending 4 requests each arriving at a rate of around 10 users p/s over 60s (2400 API requests in total each of which perform several reads and writes).
We are seeing this issue randomly occurring in our App Engine Flex NodeJS instances running Node 14.16.1 and Firestore Admin SDK 9.2.0. Once it starts all further Firestore requests fail with Error: 8 RESOURCE_EXHAUSTED: Bandwidth exhausted rendering the instance useless and forcing us to manually delete it in the App Engine console. Extremely unfortunate behavior that we need a speedy resolution to.
I had the same problem for reading all data from firebase, after a while, I figured out if we stop this process and run a new process we can pass the error and continue the job.
then I used child-process and it helped me:
I did write a parent script and a child script,
Parent script runs child script as a child-process,
The child goes through a collection until gets [8 RESOURCE_EXHAUSTED] error, then sends a message to the parent to inform it of the error.
Then parent kills the child and creates a new one and tells it where to start reading again.
This is a solution that works 100 percent, but it's a little advance, and beginners-intermediates may not able to implement it.
Then parent kills child and create a new one and tells it where to start reading again.
@navidshad how do you pass the "where to start reading again" part? Do you use some kind of cursor?
I tried the same approach with child-process some years ago, it almost worked, but I think I got stuck with cursors (it was datastore, not firestore, at that moment, if it matters).
Then parent kills child and create a new one and tells it where to start reading again.
@navidshad how do you pass the "where to start reading again" part? Do you use some kind of cursor?
I tried the same approach with child-process some years ago, it almost worked, but I think I got stuck with cursors (it was datastore, not firestore, at that moment, if it matters).
Actually, I have written a cursor that manages everything relative to that issue. I can put the code here.
Activity
schmidt-sebastian commentedon Sep 30, 2019
@zulqarnainhanif Thanks for filing this issue and sorry to hear about your troubles. We have seen other reports internally and believe that the underlying issue is a RESOURCE_EXHAUSTED error from the backend. To debug your case, we will likely need project specific information, which will help us look at the workload at the time you experienced this error.
Do you mind sharing your Project ID with us via a customer service request (via https://cloud.google.com/support/)? Thank you!
I will close this issue for now as this is likely project specific.
schmidt-sebastian commentedon Oct 1, 2019
I am re-opening this for now as @mikelehen tracked down an internal root cause for these error messages. The error seems to only reproduce with Node v10.16.3 and v12.11.0 and is likely caused by nodejs/node#29223
You can work around this by downgrading the network layer for Firestore to an implementation that does not rely on Node's HTTP/2 network stack. This can be done as such:
schmidt-sebastian commentedon Oct 2, 2019
@zulqarnainhanif We were able to confirm that nodejs/node#29223 is indeed the root cause. We hope to get this fixed in the underlying Node implementation soon.
2 remaining items
arashkay commentedon Jan 29, 2020
We are facing the same issue
Bandwidth exhaustedin our production environment when requests are high.I tried your support link @schmidt-sebastian but it seems there's no place to create a ticket unless we pay for it and upgrade to paid support plans?
Can you please let us know if this is something that will be fixed soon? or what solution we should have meanwhile?
schmidt-sebastian commentedon Jan 29, 2020
@arashkay Unfortunately, you will have to wait until Node 10.18.1 is deployed to our container frameworks. Per https://cloud.google.com/functions/docs/concepts/exec, the version is currently at 10.15.3.
ryansydnor commentedon Feb 3, 2020
This is also happening to me in the Node 11.12 Docker image.
firestore.settings({grpc});seems to have fixed the problem for now!schmidt-sebastian commentedon Feb 3, 2020
@ryansydnor
firestore.settings({grpc})bypasses this problem by using a different HTTP/2 stack.When you can switch to one of the Node version ranges mentioned above (Node 10.18.1+, Node 12.3.2+ and Node 12.4.1+), then you can switch back to the main GRPC stack. This should again reduce your binary size and startup time.
Do note that Node's version ranges are distinct and that the bug is addressed individually in each version - i.e. the fix in 10.1.8.1 is not part of Node 11.x or Node 12.0.
asifmadnan commentedon Apr 21, 2020
If I use current stable node version 12.16.2 will it be sufficient?
schmidt-sebastian commentedon Apr 21, 2020
It should be.
dooleyb1 commentedon May 8, 2020
Experiencing a similar issue when performing some reasonably light stress testing on my API which interacts with Firestore using
"firebase-admin": "^8.12.0"(NodeJS).Performing a stress test which replicates 600 users sending 4 requests each arriving at a rate of around 10 users p/s over 60s (2400 API requests in total each of which perform several reads and writes).
I am doing such a stress test as I have recently moved to Distributed Counters off the back of an issue I was having in relation to contention issues - see firebase/firebase-admin-node#856 (comment).
Approx 2k of these requests succeed as expected and around 400 fail due to the following error:
dooleyb1 commentedon May 11, 2020
This seems to have resolved the
Bandwidth exhausted issue. Thanks!Limule commentedon Apr 26, 2021
@dooleyb1 Hi, how did you solve it ?
klon commentedon May 4, 2021
We are seeing this issue randomly occurring in our App Engine Flex NodeJS instances running Node 14.16.1 and Firestore Admin SDK 9.2.0. Once it starts all further Firestore requests fail with
Error: 8 RESOURCE_EXHAUSTED: Bandwidth exhaustedrendering the instance useless and forcing us to manually delete it in the App Engine console. Extremely unfortunate behavior that we need a speedy resolution to.navidshad commentedon Jul 5, 2021
I had the same problem for reading all data from firebase, after a while, I figured out if we stop this process and run a new process we can pass the error and continue the job.
then I used child-process and it helped me:
This is a solution that works 100 percent, but it's a little advance, and beginners-intermediates may not able to implement it.
I have written a gist and explained full implemention:
https://gist.github.com/navidshad/973e9c594a63838d1ebb8f2c2495cf87
kirillgroshkov commentedon Jul 6, 2021
@navidshad how do you pass the "where to start reading again" part? Do you use some kind of cursor?
I tried the same approach with child-process some years ago, it almost worked, but I think I got stuck with cursors (it was
datastore, notfirestore, at that moment, if it matters).navidshad commentedon Jul 6, 2021
Actually, I have written a cursor that manages everything relative to that issue. I can put the code here.
This is a gist I have written today to explain this solution:
https://gist.github.com/navidshad/973e9c594a63838d1ebb8f2c2495cf87