haadcode / ipfs-daemon

Get a running IPFS daemon quickly and easily
26 stars 7 forks source link

Getting error upon using latest version with Orbit-DB #4

Closed HenryNguyen5 closed 8 years ago

HenryNguyen5 commented 8 years ago

Error: Hash can't be null! at OrbitDB._onWrite (/home/user/Code/ipfsTestSite/node_modules/orbit-db/src/OrbitDB.js:103:21) at emitTwo (events.js:106:13) at EventEmitter.emit (events.js:191:7) at _oplog.add.then.then.then.then.then.then (/home/user/Code/ipfsTestSite/node_modules/orbit-db/node_modules/orbit-db-kvstore/node_modules/orbit-db-store/src/Store.js:89:33) at process._tickDomainCallback (internal/process/next_tick.js:129:7)

The example code i used to produce it is as follows: const OrbitDB = require('orbit-db'); const IPFS = require('ipfs-daemon');

const ipfsOptions = { IpfsDataDir: '/tmp/' + 7, Addresses: { API: '/ip4/127.0.0.1/tcp/0', Swarm: ['/ip4/0.0.0.0/tcp/0'], Gateway: '/ip4/0.0.0.0/tcp/0' }, }

const ipfs = new IPFS(ipfsOptions); ipfs.on('ready', () => { console.log("IPFS READY"); console.log(ipfs) const orbitdb = new OrbitDB(ipfs); const db = orbitdb.kvstore('application.settings'); console.log(db); db.put('voleume', 100).catch((e) => {console.log(e.stack)}); });

ipfs.on('error', (e) => { console.log("IPFS ERR" + e.stack); });

These are my package.json dependencies: "ipfs-daemon": "^0.3.0-beta.3", "orbit-db": "^0.16.0-beta.1"

Running the node examples in Orbit-DB does work, but i noticed it's using a much older ipfs-daemon version.

haadcode commented 8 years ago

Thanks for reporting the issue @HenryNguyen5! I will take a look at this asap. Let me know if you have more details in the meanwhile.

HenryNguyen5 commented 8 years ago

I managed to go a step further by doing an 'npm install' inside /home/user/Code/ipfsTestSite/node_modules/orbit-db/ which removed the 'hash cant be null!' error. But now if i put in a KV and then try to get it it will return undefined.

HenryNguyen5 commented 8 years ago

Nevermind, was a typo for the 2nd error. Still seems odd that I had to do an npm install inside /home/user/Code/ipfsTestSite/node_modules/orbit-db/ to get it working though