Firestore query failed with code=RESOURCE_EXHAUSTED, description=Quota exceeded.
See original GitHub issueDescribe your environment
- Android Studio version: Arctic Fox 2020.3.1 Patch 3
- Firebase Component: Firestore
- Component version:
implementation platform('com.google.firebase:firebase-bom:28.4.1')
implementation 'com.google.firebase:firebase-firestore-ktx'
[REQUIRED] Step 3: Describe the problem
My app queries from Firestore, and when the result contains more than 2000 items, the query always fails with error WatchStream]: (c98c54b) Stream closed with status: Status{code=RESOURCE_EXHAUSTED, description=Quota exceeded., cause=null}.
The detail error stacktrace can be downloaded here.
Note:
- This problem only happens on Android SDK. I am able to query on iOS and Web without a problem.
- This problem happens when each row contains quite significant amount of data. In my test, the final result contains around 5000 items, total size is about 120MB
- I am on Blaze plan
- I have waited for more than 30 minutes before executing a new query
Steps to reproduce:
Simply execute a query. The query will fail for user with a lot of data.
Relevant Code:
fun getAll() {
val ref = FirebaseFirestore.getInstance()
.collection("users")
.document(userId)
.collection("notes")
.limit(2500)
// This query always failed with the limit >= 2500
ref.get(Source.SERVER)
.addOnSuccessListener { results ->
Log.d("Test","results size" + results.size())
}.addOnFailureListener {
it.printStackTrace()
Log.d("Test", "exception ${it.localizedMessage}")
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:27 (1 by maintainers)
Top Results From Across the Web
Firestore quota exceeded for a flutter app - firebase
According to the error message: [code=resource-exhausted] can be due to over passing the cache of the device/emulator. Using Firestore settings, ...
Read more >FirebaseFirestoreException.Code - Google
Code.RESOURCE_EXHAUSTED. Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
Read more >[Solved]-(333c7ef) Stream closed with status: Status{code ...
... with status: Status{code=RESOURCE_EXHAUSTED, description=Quota exceeded., ... is that the error you are getting is indeed the quotas exausted error, ...
Read more >Troubleshooting | Firestore - Google Cloud
Latency; Error Codes ... Sustained traffic exceeding the 500-50-5 rule. read, write ... Listening to large documents or to a query with many...
Read more >Firestore: How to stay within the limits of Firebase's new ...
Firestore's query language isn't as richly expressive as SQL is, but there are still a number of ways to restrict your queries so...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@thomasdao Yes, after looking at Francisco’s report + the absence of backend logs, it’s clear that the error is thrown by SQLite after the cache is full. To workaround this, you can either clear the cache directory with Android utility methods, or increase the size of the cache via Firestore settings.
Internally, we’ll look at improving documentation around this error case and improving the error messages. I’m going to close the issue, but feel free to ask any other questions you may have!
That’s right. I meant spark plan. I will edit. Thanks.