-
Notifications
You must be signed in to change notification settings - Fork 928
FIrefox Private Browsing: A mutation operation was attempted on a database that did not allow mutations #5377
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
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Hi @piperone. Based on the error message this doesn't appear to be a duplicate of #4069. Specifically, firebase-js-sdk/packages/firestore/src/local/indexeddb_persistence.ts Lines 281 to 285 in 280be6d
In the meantime, could you try upgrading to the latest version, namely 8.10.0 (the bug report indicates that you are using a 5-month-old version: 8.3.1)? Also, if you are able to provide a minimal reproduction app that could greatly speed up the investigation. If not, is there a code snippet you could provide that causes the error? |
@dconeybe Thanks a bunch for addressing the issue so promptly, appreciate it. You're right of course, I was on an outdated version of firebase. Updating to 8.10.0 unfortunately didn't remove the error. I'm using firebase along with Vue and a UI component framework called Quasar. Running my Quasar app is when I get the error. Here's the init code I use for Firebase: import firebase from 'firebase/app';
import 'firebase/firestore';
const firebaseApp = firebase
.initializeApp({
// My credentials
});
// Get a Firestore instance
const db = firebaseApp.firestore();
db.settings({
persistence: true,
});
db.enablePersistence({
synchronizeTabs: true,
}); If you need to see this in action, I created a minimal Quasar app repo. BTW, Quasar has its own CLI which I recommend in order to run my example.
|
@piperone Thank you for all of that information. I haven't tried out your sample app yet but after a bit of research I'm wondering if this may be due to Firefox's lack of support for IndexedDB in private browsing sessions. Could you try the workaround documented at https://bugzilla.mozilla.org/show_bug.cgi?id=1639542#c9 to see if it fixes the issue?
Obviously, this isn't a real solution for customers but it would confirm whether or not the absence of IndexedDB support is the culprit. |
Update: I've confirmed that the culprit is lack of IndexedDB support in Firefox private browsing. Off the top of my head, I can think of two options:
I'm pretty sure that all we can do in Firestore is fail more gracefully in this scenario, which I'll investigate. |
Understood. Neither of your suggestions are viable for me unfortunately. It's still early days for the app I'm working on, so it's not a pressing matter. It'd be good if this case was handled with more grace by the library in the future, of course. Thanks again. |
I've merged a fix to improve the error message: #5396. Note that when you try to enable persistence in a Firefox private browsing session it is failing to open an IndexedDB connection and therefore is falling back to "memory persistence", a.k.a. no persistence. So firestore will still work just fine, but there will effectively be no persistence. Maybe this is acceptable since it is a private browsing session anyways which I'd expect wouldn't persist stuff. |
Thanks for your work on this, I appreciate it. Even though fixing the error isn't possible at your end currently, a more descriptive error-message should help devs in the future. For my particular app, I'll probably disallow using private browsing sessions; it's an app used by a small number of expert users. It doesn't make sense with private browsing in my usecase anyway. Thanks again! |
Steps to reproduce:
I'm seeing the error "A mutation operation was attempted on a database that did not allow mutations" when starting my app in Firefox' private browsing mode. This was reported in #4069 and fixed in #4146 (8.1.2) so could this be a regression?
Exact error message:
Uncaught (in promise) IndexedDbTransactionError: IndexedDB transaction 'getHighestListenSequenceNumber' failed: InvalidStateError: A mutation operation was attempted on a database that did not allow mutations.
The text was updated successfully, but these errors were encountered: