Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipfs.id is not a function #161

Closed
Powersource opened this issue Aug 30, 2017 · 4 comments
Closed

ipfs.id is not a function #161

Powersource opened this issue Aug 30, 2017 · 4 comments
Labels
kind/support A question or request for support

Comments

@Powersource
Copy link

Powersource commented Aug 30, 2017

There isn't much info on ipfsd.local but from this example it seemed like this should work.

const ipfsd = require('ipfsd-ctl')

ipfsd.local((err, ipfs) => {
    if (err) { throw err }

    ipfs.id(function (err, id) {
        if (err) { throw err }
        console.log(id);
    });
});

Error:

Uncaught TypeError: ipfs.id is not a function
    at ipfsd.local (file:///home/me/prj/web/viddist/index.js:8:10)
    at process.nextTick (/home/me/prj/web/viddist/node_modules/ipfsd-ctl/src/index.js:57:7)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)

Had the same result with and without IPFS_EXEC set. Also tried having a regular go-ipfs node running and not.

{"diskinfo":{"free_space":108446048256,"fstype":"61267","total_space":95631613952},"environment":{"GOPATH":"/home/me/prj/go","IPFS_PATH":""},"ipfs_commit":"c5d362e3f","ipfs_version":"0.4.11-dev","memory":{"swap":0,"virt":227436000},"net":{"interface_addresses":["/ip4/127.0.0.1","/ip4/10.2.202.244","/ip6/::1","/ip6/fe80::80ca:2835:20da:f537"],"online":false},"runtime":{"arch":"amd64","compiler":"gc","gomaxprocs":4,"numcpu":4,"numgoroutines":6,"os":"linux","version":"go1.8.3"}}
@daviddias
Copy link
Member

@Powersource that ipfs instance is not an ipfs-api instance. Log its methods, it is something that is created here that exposes some commands but not all. You want to do a disposableAPI or create a js-ipfs-api instance that connects to that daemon started.

@Powersource
Copy link
Author

Ok thanks, looked into the code a bit more and I think this should work (followed by using the Addr's to
connect using js-ipfs-api):

const ipfsd = require('ipfsd-ctl')

ipfsd.local((err, ipfs) => {
    if (err) { throw err }

    console.log(ipfs.apiAddr)
    console.log(ipfs.gatewayAddr)
});

Both of those log null. And I don't really understand the comment in the example linked above // opens an api connection to local running ipfs node.

@daviddias daviddias added the kind/support A question or request for support label Sep 2, 2017
@daviddias
Copy link
Member

Fixed with #165 :)

@Powersource
Copy link
Author

Trying this with 0.23 it still doesn't seem to work. My code.

{"diskinfo":{"free_space":104992063488,"fstype":"61267","total_space":92177629184},"environment":{"GOPATH":"/home/me/prj/go","IPFS_PATH":""},"ipfs_commit":"f55a7a03b","ipfs_version":"0.4.11-dev","memory":{"swap":0,"virt":219328000},"net":{"interface_addresses":["/ip4/127.0.0.1","/ip4/10.2.253.37","/ip6/::1","/ip6/fe80::80ca:2835:20da:f537"],"online":false},"runtime":{"arch":"amd64","compiler":"gc","gomaxprocs":4,"numcpu":4,"numgoroutines":5,"os":"linux","version":"go1.9"}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support A question or request for support
Projects
None yet
Development

No branches or pull requests

2 participants