-
Notifications
You must be signed in to change notification settings - Fork 932
firestore Failed to get document because the client is offline (even with persistance enabled) #3207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@ulver2812 Thanks for writing this up. The SDK should raise snapshots from cache if there is cached data available. We will not raise a snapshot from cache if there are no documents that match your query or get()s. Can you confirm that you have populated the cache and have run the same query before you went offline? |
@schmidt-sebastian thanks for your reply, I made some test and I discovered that if I follow these steps it works:
So in this way it works but if I don't have cached data I get an error? Is this the normal behaviour? So I need to handle this scenario in the Thanks |
This just started happening to me yesterday. My code worked. I get back from running errands and started getting this error. But without enabling persistence.. Code:
Then in the @firebase/firestore debug in my console I get a bunch of data from the document I called, then I get these logs that point towards error in their context to me.
Then I get these console errors:
I'm online, on my phone and on my PC right next to my router. For what its worth, I am using Expo React native, but It seems to use the latest javascript sdk. package.json
|
Hello, Yes it's the normal behaviour to get an error with get on a collection if the service could not be reached (when online and nothing found you got a snapshot.exists set to false). Your steps are good. Fetch online data > automatic persist > get same response if offline |
@ulver2812 Yes, if there is no cached data you will get an error when the client is offline. @PandaPalumbo Please make sure to use Firestore 7.15.1 (your log lines still say 7.15.0). This version includes an important fix to #2923, which could explain the behavior you are seeing. Since this is working as intended, I am going to close this issue. |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
I'm using Firebase JS SDK with Ionic 3 and I enabled the offline capabilities with:
but when I trying to retrive any document in firestore while I'm offline I get this error:
Failed to get document because the client is offline
I'm expecting to receive the cached data while I'm offline and not an error, or if there isn't any data an empty object or something like this.
Is this normal behaviour ?
For instance I get this error during this query (but I get the same error on any get query):
The text was updated successfully, but these errors were encountered: