Js-ipfs: Firefox: OpenError: A mutation operation was attempted on a database that did not allow mutations.

Created on 8 Jun 2018  路  6Comments  路  Source: ipfs/js-ipfs

  • Version: 0.29.3
  • Platform: windows 10

Type: Bug

Severity: Critical

Description: Just got an error and files stopped loading In Firefox:

OpenError: A mutation operation was attempted on a database that did not allow mutations.
https://unpkg.com/ipfs/dist/index.js:116237:29

Steps to reproduce the error:

const config = {
  repo: 'osliki-classi',
  EXPERIMENTAL: {
    pubsub: true,
    relay: {
      enabled: true,
      hop: {
        enabled: true,
        //active: true
      }
    }
  },
  config: {
    Addresses: {
      Swarm: [
        '/dns4/wrtc-star.discovery.libp2p.io/tcp/443/wss/p2p-webrtc-star',
        '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star',
      ]
    },
    Bootstrap: [
      '/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
      '/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3',
      '/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
      '/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu',
      '/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm',
      '/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64',
      '/dns4/wss0.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
      '/dns4/wss1.bootstrap.libp2p.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6',
      '/dns4/bootstrap.osliki.net/tcp/443/wss/ipfs/QmfJB77qXfiEdJkaSxpZgiMh9kAPiDBj3ga7TxF72QdWtf',
      '/p2p-circuit/ipfs/QmfJB77qXfiEdJkaSxpZgiMh9kAPiDBj3ga7TxF72QdWtf',
    ]
  }
}

Most helpful comment

It does seem like we could surface a much clearer error message in this case, though, and say directly that IndexedDB is not supported in this browser or that we鈥檙e out of space (IIRC Safari鈥檚 private browser throws a quota exceeded error). Even if we can鈥檛 fix the problem (it鈥檚 not an unreasonable error in private mode), we can at least make it not seem like something is broken.

All 6 comments

Are you in a private window @Artod?

Context: IndexedDB doesn't work in private browsing mode https://bugzilla.mozilla.org/show_bug.cgi?id=781982

I think you could probably pass IPFS an in-memory repo to get around this but I don't know if there's a good way to detect if a browser is in private browsing mode.

Yes, seems like I was in kind of private mode (I had the option 'Never remember history' in Firefox).
Thank you for prompt answer @alanshaw

It does seem like we could surface a much clearer error message in this case, though, and say directly that IndexedDB is not supported in this browser or that we鈥檙e out of space (IIRC Safari鈥檚 private browser throws a quota exceeded error). Even if we can鈥檛 fix the problem (it鈥檚 not an unreasonable error in private mode), we can at least make it not seem like something is broken.

That error message doesn't make any sense

While hearing initial feedback for my site that uses JS-IPFS, a lot of people mentioned that the site was not working in Tor/Firefox private/and a few other browsers so I checked out why this was happening and stumbled upon this thread and could not find any code examples.

So here is one. For those who wish to run JS-IPFS in-memory, here is a quick code example:

const IPFS = require('ipfs');
const IPFSRepo = require('ipfs-repo');

const node = await IPFS.create({
    repo: new IPFSRepo("repoName", {
        autoMigrate: true,
        storageBackendOptions: {
            root: {
                extension: '',
                prefix: '',
                version: 2,
                db: require('level-mem')
            },
            blocks: {
                sharding: false,
                prefix: '',
                version: 2,
                db: require('level-mem')
            },
            keys: {
                sharding: false,
                prefix: '',
                version: 2,
                db: require('level-mem')
            },
            datastore: {
                sharding: false,
                prefix: '',
                version: 2,
                db: require('level-mem')
            }
        }
    })
});
Was this page helpful?
0 / 5 - 0 ratings