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

bug: dag.put cannot read property 'put' of undefined #1492

Closed
0x-r4bbit opened this issue Aug 7, 2018 · 1 comment
Closed

bug: dag.put cannot read property 'put' of undefined #1492

0x-r4bbit opened this issue Aug 7, 2018 · 1 comment

Comments

@0x-r4bbit
Copy link
Contributor

  • Version: 0.31.2
  • Platform: Node
  • Subsystem: dag

Type: Bug

Severity: High

Description:

I was just about to verify ipfs-inactive/interface-js-ipfs-core#307 (comment) and noticed that ipfs.dag.put throws in the latest release:

/Users/pascalprecht/projects/ipfs/playground/node_modules/ipfs-block-service/src/index.js:64
    this._repo.blocks.put(block, callback)
                      ^

TypeError: Cannot read property 'put' of undefined
    at BlockService.put (/Users/pascalprecht/projects/ipfs/playground/node_modules/ipfs-block-service/src/index.js:64:23)
    at waterfall (/Users/pascalprecht/projects/ipfs/playground/node_modules/ipld/src/index.js:399:28)
    at nextTask (/Users/pascalprecht/projects/ipfs/playground/node_modules/async/waterfall.js:16:14)
    at next (/Users/pascalprecht/projects/ipfs/playground/node_modules/async/waterfall.js:23:9)
    at /Users/pascalprecht/projects/ipfs/playground/node_modules/async/internal/onlyOnce.js:12:16
    at setImmediate (/Users/pascalprecht/projects/ipfs/playground/node_modules/ipld-dag-cbor/src/util.js:96:22)
    at Immediate.<anonymous> (/Users/pascalprecht/projects/ipfs/playground/node_modules/async/internal/setImmediate.js:27:16)
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)

Steps to reproduce the error:

Here's the code that causes this error:

const IPFS = require('ipfs');

const ipfs = new IPFS();

const obj = { simple: 'object' };

ipfs.dag.put(obj, { format: 'dag-cbor', hashAlg: 'sha3-512' }, (err, cid) => {
  console.log(cid.toBaseEncodedString());
});

I so it seems the internal blockservice doesn't have an IPFS repo, so I tried specifying a custom one a la

const ipfs = new IPFS({
  repo: '/tmp/some-folder'
});

Which didn't do the trick.

@0x-r4bbit
Copy link
Contributor Author

Argh. Needed to wait for ready event. Sorry for this. Closing.

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

1 participant