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

DHT is not available #1602

Closed
mccoysc opened this issue Sep 30, 2018 · 11 comments
Closed

DHT is not available #1602

mccoysc opened this issue Sep 30, 2018 · 11 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@mccoysc
Copy link

mccoysc commented Sep 30, 2018

Uncaught (in promise) Error: DHT is not available Error: DHT is not available
at Object.findProviders (content-routing.js:7)
at Function.findprovs.n (dht.js:86)
at index.js:41
at i.e._execute (bluebird.min.js:29)
at i._resolveFromExecutor (bluebird.min.js:30)
at new i (bluebird.min.js:30)
at Object.findprovs (index.js:35)
at :1:38
at :1:100

@vasco-santos
Copy link
Member

Hello @mccoysc

The DHT is not enabled by default on js-ipfs at the moment. You can check how to use it through js-ipfs#optionsexperimental. Let us know if this did not solve your problem.

We are working on having it enabled by default in a near future, you can track this on js-ipfs#856

@mccoysc
Copy link
Author

mccoysc commented Oct 5, 2018

in browser ,i config the dht to be true,the error appear again

@alanshaw
Copy link
Member

@mccoysc can you post the code you're using to configure the DHT and the code you're calling to cause this error?

@alanshaw
Copy link
Member

ping @mccoysc

@mccoysc
Copy link
Author

mccoysc commented Oct 18, 2018

await ipfs.dht.findpeer("QmXp22HFGvo29o6dsGnJwxaHvTieEqMGr1pS55ZsZUonMf")

Uncaught (in promise) Error: Callback function "anonymous" timed out. Error: Callback function "anonymous" timed out.
at timeout.js:68

(anonymous) @ timeout.js:68
  setTimeout (async)    
  (anonymous) @ timeout.js:85
  (anonymous) @ initialParams.js:11
  o @ index.js:566
  c @ waterfall.js:16
  f @ waterfall.js:23
  (anonymous) @ onlyOnce.js:12
  (anonymous) @ index.js:15
  (anonymous) @ setImmediate.js:40
  f @ setImmediate.js:69
  r @ setImmediate.js:109
  postMessage (async)    
  n @ setImmediate.js:120
  u.setImmediate @ setImmediate.js:27
  (anonymous) @ index.js:14
  Promise.then (async)    
  a @ index.js:13
  (anonymous) @ crypto-sha1-2-browser.js:37
  sha2256 @ crypto-sha1-2-browser.js:49
  o.digest @ index.js:84
  t.convertPeerId @ utils.js:33
  t @ index.js:529
  c @ waterfall.js:16
  t.default @ waterfall.js:26
  findPeerLocal @ index.js:528
  routingTable.find @ index.js:426
  i.convertPeerId @ routing.js:89
  (anonymous) @ index.js:15
  (anonymous) @ setImmediate.js:40
  f @ setImmediate.js:69
  r @ setImmediate.js:109
  postMessage (async)    
  n @ setImmediate.js:120
  u.setImmediate @ setImmediate.js:27

@alanshaw

@mccoysc
Copy link
Author

mccoysc commented Oct 18, 2018

really,"time out" should not be an error.
when time out,the function should rerurn an error object or undefined but cause an error thrown

@mccoysc
Copy link
Author

mccoysc commented Oct 18, 2018

and also, it's not work well.
await ipfs.dht.findpeer("QmXp22HFGvo29o6dsGnJwxaHvTieEqMGr1pS55ZsZUonMf")
"QmXp22HFGvo29o6dsGnJwxaHvTieEqMGr1pS55ZsZUonMf" is node itself,should not be time-out,but timed-out

@mccoysc
Copy link
Author

mccoysc commented Oct 18, 2018

and if await ipfs.dht.findpeer("QmZ6YuHZUJd6k9hbJNaNUZBsWfwZGv62piZMU6oxHPBtDx"),it works well.
so, the dht can't find the node itself?

@daviddias daviddias added the kind/bug A bug in existing code (including security flaws) label Dec 9, 2018
@daviddias
Copy link
Member

@mccoysc can you share a full example of how you are creating the node and making this call?

@mccoysc
Copy link
Author

mccoysc commented Dec 9, 2018

just like the code in this issue

@daviddias daviddias added the status/ready Ready to be worked label Dec 9, 2018
@alanshaw
Copy link
Member

This is because the DHT module is not passed to libp2p in the browser. In 0.34 DHT will be enabled in the browser also.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

4 participants