Firebase-js-sdk: Firefox Private Browsing: A mutation operation was attempted on a database that did not allow mutations

Created on 13 Nov 2020  路  9Comments  路  Source: firebase/firebase-js-sdk

  • Operating System version: Ubuntu
  • Browser version: Firefox 82.0.3 (Private Browsing)
  • Firebase SDK version: 8.0.2
  • Firebase Product: auth, firestore (auth, database, storage, etc)

Steps to reproduce:

When opening the website with Firefox private browsing the following error is thrown:

Uncaught Error: InvalidStateError: A mutation operation was attempted on a database that did not allow mutations.

This is thrown here:

function uk(a) {
    return new D(function (b, c) {
      var d = a.v.open("firebaseLocalStorageDb", 1);

      d.onerror = function (e) {
        try {
          e.preventDefault();
        } catch (f) {}

        c(Error(e.target.error));
      };
auth internal-bug-filed

Most helpful comment

Hi everyone, thanks for your patience. This should be fixed by https://github.com/firebase/firebase-js-sdk/pull/4146, which is included in 8.1.2. Please upgrade to 8.1.2 for the fix. Thanks!

All 9 comments

Triage note: This seems to be in auth code accessing indexedDB.

I'm getting the same issue in Firebox 82.0.3 Private Browsing with Firebase SDK version 8.0.2 on Windows 10.

Triage note: This seems to be in auth code accessing indexedDB.

Is the error raised from here? @hsubox76
https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/src/storage/indexeddb.js#L298

Worth mentioning that this seems to be a fatal error. There doesn't seem to be a way to catch errors when calling firebase.auth() to fail authentication. Auth doesn't have any error hooks so anything waiting on it will hang indefinitely.

I guess the only workaround is to wrap any firebase.auth calls in a timeout since there's a chance it'll hit a silent dead end.

Is someone find a solution to firebase.getAuth() signIn on Firefox Private window?

@aliokan in my own project at least, this bug only appears in very recent versions. If you step back through the availalbe versions until the bug goes away, you should be able to mitigate it for the the time being.

This bug appeared in 8.0.2 release https://firebase.google.com/support/release-notes/js#version_802_-_november_12_2020
Probably because of this fix: #1926

I think this may be the same bug as https://github.com/firebase/firebase-js-sdk/issues/4113. I believe Firefox's message for that same error ("IDBFactory.open() called in an invalid security context") is the text reported in this issue ("A mutation operation was attempted on a database that did not allow mutations.")

Hi everyone, thanks for your patience. This should be fixed by https://github.com/firebase/firebase-js-sdk/pull/4146, which is included in 8.1.2. Please upgrade to 8.1.2 for the fix. Thanks!

Was this page helpful?
0 / 5 - 0 ratings