js-libp2p: Error: No content routers available
DHT doesn’t seem to work because of this. Built the latest js-ipfs + the DHT PR + the latest js-libp2p:
Then tried to use DHT:
ipfs.dht.findprovs('QmXXtHtDwXFbCTzMDjacZxid6CCNY4m5oM6MgBhyPVT3Tr')ipfs._libp2pNode.contentRouting.findProviders('QmXXtHtDwXFbCTzMDjacZxid6CCNY4m5oM6MgBhyPVT3Tr', 5000, (...args) => console.log('done:', ...args));
Same result: the “No content routers available” error.
Dump of the console logs:
ipfs.dht.findprovs('QmXXtHtDwXFbCTzMDjacZxid6CCNY4m5oM6MgBhyPVT3Tr')
Promise {<rejected>: Error: No content routers available
at Object.findProviders (https://ipfs.io/ipfs/QmdFgDWRTB4L3K…}
content-routing.js:28 Uncaught (in promise) Error: No content routers available
at Object.findProviders (content-routing.js:28)
at Function.findprovs.promisify (dht.js:95)
at index.js:41
at new Promise (<anonymous>)
at Object.findprovs (index.js:35)
at <anonymous>:1:10
findProviders @ content-routing.js:28
findprovs.promisify @ dht.js:95
(anonymous) @ index.js:41
(anonymous) @ index.js:35
(anonymous) @ VM1356:1
6crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
at PeerId.createFromPubKey (crypto.js:80)
at pubKey.hash (index.js:201)
at Multihashing.Multihashing.digest (index.js:33)
at index.js:15
at run (setImmediate.js:40)
at runIfPresent (setImmediate.js:69)
at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
ipfs._libp2pNode.contentRouting.findProviders('QmXXtHtDwXFbCTzMDjacZxid6CCNY4m5oM6MgBhyPVT3Tr', 5000, () => {});
undefined
2crypto.js:80 Uncaught Error: dialed to the wrong peer, Ids do not match
at PeerId.createFromPubKey (crypto.js:80)
at pubKey.hash (index.js:201)
at Multihashing.Multihashing.digest (index.js:33)
at index.js:15
at run (setImmediate.js:40)
at runIfPresent (setImmediate.js:69)
at onGlobalMessage (setImmediate.js:109)
PeerId.createFromPubKey @ crypto.js:80
pubKey.hash @ index.js:201
Multihashing.Multihashing.digest @ index.js:33
(anonymous) @ index.js:15
run @ setImmediate.js:40
runIfPresent @ setImmediate.js:69
onGlobalMessage @ setImmediate.js:109
postMessage (async)
registerImmediate @ setImmediate.js:120
setImmediate @ setImmediate.js:27
(anonymous) @ index.js:14
Promise.then (async)
nodeify @ index.js:13
(anonymous) @ crypto-sha1-2-browser.js:37
sha2256 @ crypto-sha1-2-browser.js:49
Ipfs../node_modules/peer-id/node_modules/multihashing-async/src/index.js.Multihashing.digest @ index.js:84
Multihashing @ index.js:28
hash @ rsa-class.js:43
Ipfs../node_modules/peer-id/src/index.js.exports.createFromPubKey @ index.js:196
Ipfs../node_modules/libp2p-secio/src/handshake/crypto.js.exports.identify @ crypto.js:72
waterfall @ propose.js:24
nextTask @ waterfall.js:16
next @ waterfall.js:23
(anonymous) @ onlyOnce.js:12
onComplete @ decode.js:49
reader.read @ decode.js:125
drain @ index.js:39
more @ index.js:55
(anonymous) @ index.js:66
(anonymous) @ index.js:20
(anonymous) @ map.js:19
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ map.js:19
(anonymous) @ source.js:31
ipfs._libp2pNode.contentRouting.findProviders('QmXXtHtDwXFbCTzMDjacZxid6CCNY4m5oM6MgBhyPVT3Tr', 5000, (...args) => console.log('done:', ...args));
VM1532:1 done: Error: No content routers available
at Object.findProviders (content-routing.js:28)
at <anonymous>:1:33
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (8 by maintainers)
Commits related to this issue
- test: add sample network circuit relay tests (#275) * test: add sample network circuit relay tests * test: use ephemeral ports — committed to jacobheun/js-libp2p by jacobheun 8 years ago
- refactor: testing refactor switch merge (#1) * chore: update contributors * chore: release version v0.29.0 * fix: move emitters to last thing in the method (#218) * fix: move emitters to las... — committed to jacobheun/js-libp2p by jacobheun 7 years ago
@hapsody the latest version of js-ipfs has a different configuration for DHT now, as it has moved out of the experimental configuration block, so you dont actually have it enabled yet. Check out the libp2p configuration for the latest ipfs release, https://github.com/ipfs/js-ipfs/tree/v0.36.4#optionslibp2p.
The dht is currently enabled via the libp2p config option. The following should give you the minimum needed, with a basic example of finding one of the ipfs bootstrap nodes after a 5s delay
@ohager we are working on making the DHT more performant for when it launches enabled by default js-ipfs, you can track that at https://github.com/ipfs/js-ipfs/pull/1994. I’d check that PR out for some potential configurations. Changing your High and Low Watermarks for connection manager could help, you might have too many connections open for your machine which could account for the cpu usage.
As long as all those nodes are running a DHT and connected to the same network you should be able to find them. You can add timeouts to the call, but I would recommend playing with the config to try and get your cpu down.
Since we’ve gotten a bit off topic from this original issue and the original question has been resolved, I am going to close this issue. If you’d like to talk more about the DHT and setup please jump over to https://discuss.libp2p.io. Happy to continue conversations over there and more people might benefit from the discussion there 😃
In the latest release candidate
No content routers availableindicates that you have not supplied any custom content routers and that the DHT is not enabled. The index.js file you linked looks to be the whole build file so I wasn’t able to fund your specific code.Can you check that you’ve turned the dht on via the
js-ipfsoptions?