-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Firestore blows up on GET {source: "cache"} if document exists in cache #1632
Comments
Additional info: I can clean up the corrupted data by simply doing another request with So it's likely some discrepancy between the local database and the server. |
Given step 1 of "Get your data in a corrupted state. Not sure how" this isn't going to be a terribly actionable bug. Please try to narrow this down somehow. Does this happen with a certain kind of data? Duration? Worst case, could you get a dump of the leveldb database if you find a document that has this behavior? We'll need the dump and a full name of the document (or the query you're running that's hitting it). If you're running in the simulator on a recent Xcode you can find the database in a location matching this shell glob:
|
I have a dump of the database and the query. I just sent it to one of the Firestore core team members. |
Thanks for the report! I've reproduced the issue and believe I have a fix (see referenced PR above). |
Cool! Does this bug affect Android too? I'm not certain but I'm relatively sure I've experienced it on Android as well. |
@scottmas It shouldn't crash, but it will probably give you a failed |
Okay great, what error code does it raise? I'm currently handling the code |
Yes, that is the correct code although I'm not sure if/when you'd encounter it as a string |
I'm using react-native-firebase, so they must do some translation layer like that. |
Closing this as da1c534 should resolve this. It'll be included in our next release. |
@mikelehen I'm having a similar problem but with the If you load the page "Online" but switch to "Offline" and run this code, it won't ever throw an error:
|
@NessDan That sounds like expected behavior. The Firestore SDK is designed to work seamlessly offline and online, so when you perform write operations offline, they are queued until the client comes back online and then they're sent. If you want your writes to fail while offline, one option is to do them via the transaction API, since it is not designed to work offline. |
@mikelehen Thanks for the heads up! I'm assuming that, if someone tried to run the |
@NessDan That's correct. If this is a concern (the data is critical), you might want a UI indicator to let the user know that the data hasn't been written yet, e.g.:
Though you might want to add a small delay (200ms or something) before you show the UI indicator so that it doesn't flash in/out when you are online. All depends on the UX you are going for. |
Issue
When the data gets in a certain state (I don't know how), when I request a document with
{source: 'cache'}
that doesn't exist in the cache, the library blows up with the following error. While I am using React Native, the RN Firebase folks have triaged the issue and are relatively confident it's not on their end.Error follows:
The firestore debug logs are not helpful:
Steps to reproduce:
Note: After nuking local data, the error goes away and the request happens just fine.
Environment
IOS
macOS Sierra
RN 54
RN FIrebase 4.3.5
Firestore 5.4.1 in
Not using Typescript.
The text was updated successfully, but these errors were encountered: