Skip to content
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

IndexedDB exception on Firestore batch.commit with latest Firebase SDK 9.6.10 #6110

Closed
olivierkrener opened this issue Mar 31, 2022 · 3 comments · Fixed by #6128
Closed

IndexedDB exception on Firestore batch.commit with latest Firebase SDK 9.6.10 #6110

olivierkrener opened this issue Mar 31, 2022 · 3 comments · Fixed by #6128
Assignees

Comments

@olivierkrener
Copy link

olivierkrener commented Mar 31, 2022

[REQUIRED] Describe your environment

  • Operating System version: Windows 10, Ubuntu 20.04.3
  • Browser version: Brave V1.36.122, Chrome 99.0.4844.84
  • Firebase SDK version: 9.6.10
  • Firebase Product: firestore

[REQUIRED] Describe the problem

After upgrading from v9.6.9 to v9.6.10 with persistence enabled, some writes result in the following IndexedDB exception:

Uncaught DataError: Failed to execute 'continue' on 'IDBCursor': The parameter is less than or equal to this cursor's
DOMException: Failed to execute 'continue' on 'IDBCursor': The parameter is less than or equal to this cursor's position.
Uncaught DOMException: Failed to execute 'continue' on 'IDBCursor': The parameter is less than or equal to this cursor's position.

@firebase/firestore: Firestore (9.6.10): AsyncQueue Failed to persist write: IndexedDbTransactionError: [code=unavailable]: IndexedDB transaction 'Locally write mutations' failed: AbortError: Uncaught exception in event handler.

And the writes are not propagated to the backend.

Rolling back to v9.6.9 solves the issue.

I would guess this issue is due to the modifications on the IndexedDB data type coming with v9.6.10 as mentioned in the release notes:

Changed the format of some of the IndexedDB data stored by the Cloud Firestore SDK. This increases the performance of document lookups after an initial migration. If you do not want to migrate data, you can call clearIndexedDbPersistence() before invoking enableIndexedDbPersistence().

Note that the issue also occurs in incognito mode so it should not be due to any pre-existing data in IndexedDB or migration issue.

I cannot give a simple reproduction as the case when the write fails is a fairly complex batch operation with multiple writes (delete, set, update) and I have not tested thoroughly v9.6.10 to see if there are simpler cases leading to the same issue. But it is deterministic, in my app I can reproduce it 100% of the time, doing one specific action.

@schmidt-sebastian
Copy link
Contributor

@olivierkrener Thank you for reporting. I will try to figure out where this is going on.

@schmidt-sebastian
Copy link
Contributor

I have a strong suspicion what is causing this, but I cannot create a repro. I was wondering if it was possible to see the keys of the documents your are mutating? You can also send me the list offline (mrschmidtgoogle.com). Since I have an idea for a fix, I do not necessarily need the smallest possible repo case.

@olivierkrener
Copy link
Author

olivierkrener commented Apr 6, 2022

@schmidt-sebastian Most of these keys are autogenerated by Firestore when doing a set operation but two are custom keys: fluxes and counter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants