Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

UpgradeError Dexie specification of currently installed DB version is missing #528

Closed
haadcode opened this issue Oct 18, 2016 · 7 comments
Closed

Comments

@haadcode
Copy link
Member

Hit a blocker while trying to get js-ipfs running with orbit-db.

I initialize the daemon with:

const Ipfs = require('exports?Ipfs!ipfs/dist/index.js')
const ipfs = new Ipfs()
ipfs.init((err) => {
 // do stuff with daemon
})

Then run my code through webpack and load in the browser. The following error occurs:

index.js:64 OpenFailedError: UpgradeError Dexie specification of currently installed DB version is missing
    at Transaction.create (file:///Users/haad/code/orbit-db/examples/browser/bundle.js:78571:34)
    at file:///Users/haad/code/orbit-db/examples/browser/bundle.js:78602:61
    at executePromiseTask (file:///Users/haad/code/orbit-db/examples/browser/bundle.js:76802:12)
    at new Promise (file:///Users/haad/code/orbit-db/examples/browser/bundle.js:76608:8)
    at file:///Users/haad/code/orbit-db/examples/browser/bundle.js:78600:42
    at usePSD (file:///Users/haad/code/orbit-db/examples/browser/bundle.js:77110:19)
    at newScope (file:///Users/haad/code/orbit-db/examples/browser/bundle.js:77097:17)
    at Transaction._promise (file:///Users/haad/code/orbit-db/examples/browser/bundle.js:78596:23)
    at tempTransaction (file:///Users/haad/code/orbit-db/examples/browser/bundle.js:77579:29)
    at file:///Users/haad/code/orbit-db/examples/browser/bundle.js:77575:27
    at callListener (file:///Users/haad/code/orbit-db/examples/browser/bundle.js:76901:22)
    at endMicroTickScope (file:///Users/haad/code/orbit-db/examples/browser/bundle.js:76990:28)
    at IDBOpenDBRequest.<anonymous> (file:///Users/haad/code/orbit-db/examples/browser/bundle.js:77076:33)

Is my initialization code correct? Is there something else to get a running daemon? I tried to look at the tests but couldn't figure out what to do.

@haadcode
Copy link
Member Author

Ok, got somewhere with this. Apparently this happens when the daemon is not initialized "correctly". If I init with the following, it works fine:

const Ipfs = require('exports?Ipfs!ipfs/dist/index.js')
const IPFSRepo = require('ipfs-repo')
const idb = window.indexedDB ||
              window.mozIndexedDB ||
              window.webkitIndexedDB ||
              window.msIndexedDB
const store = require('idb-pull-blob-store')
const repo = new IPFSRepo('/tmp/hello-world', { stores: store })
const ipfs = new Ipfs(repo)
ipfs.init({ emptyRepo: true, bits: 512 }, (err) => {
  console.log("Daemon ready")
})

The question is, @diasdavid and @dignifiedquire, is this the intended API and usage for the startup sequence? There's a lot there that the user has to know / setup and imo can be improved a lot to make it easier an more intuitive to use. If not, can you fill us all in on the plan forwards?

@daviddias
Copy link
Member

This hasn't changed since April or May, you have to 1 init, then 2 load, then 3 go online, see: https://github.com/ipfs/js-ipfs/blob/master/test/utils/factory-core/index.js#L72-L96

@haadcode
Copy link
Member Author

So, are you saying this is intended final design for getting a daemon in js-ipfs and as far as you plan, there are no changes coming?

@daviddias
Copy link
Member

@haadcode ah, not that, what was was trying to convey is that the code you had written for orbit with js-ipfs in June, should still apply when it comes to spawning a daemon, that is all. We need to improve that. I want to have just a function call with an options object {online: bool}.

In another news, just got the exact error, without touching master, on js-ipfs-bitswap

 OpenFailedError: UpgradeError Dexie specification of currently installed DB version is missing
DexieError@webpack:///~/dexie/dist/dexie.js:516:0 <- test/browser.js:127637:36

@daviddias
Copy link
Member

daviddias commented Oct 20, 2016

@haadcode found the problem. tl;dr; Dixie (the wrapper used in idb-pull-blob-store) doesn't like anymore that we create instances with the same key. It is a 'feature' that is enforced in order to promote migrations to happen (more here dexie/Dexie.js#156)

A way to solve it, is just to add a bit of randomness to the repo path. However, this is not ideal, as users of IPFS apps will come to a default path.

Checking if we can override that. https://github.com/dfahlander/Dexie.js/wiki/Dexie

@dignifiedquire any special benefit of using Dixie in the first place? idb-pull-blob-store is currently a wrapper of a wrapper of a native API

For reference: dexie/Dexie.js#353

@daviddias
Copy link
Member

Another note: I noticed this on js-ipfs-bitswap tests because they always use the same key for repo, tests in js-ipfs are fine because they already had a bit of randomness

@daviddias daviddias added status/deferred Conscious decision to pause or backlog and removed js-ipfs-backlog labels Dec 5, 2016
@daviddias
Copy link
Member

Haven't seen this problem again. Closing, reopen if necessary

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

No branches or pull requests

2 participants