Js-ipfs: Error: DHT is not available

Created on 29 Aug 2017  路  10Comments  路  Source: ipfs/js-ipfs

I made a demo that worked up until very recently. It demonstrated serving files from the browser-side. The piece of info I needed to get it to work was to pre-configure the Bootstrap. Now the files are not available on the gateway, and I am getting tons of error in the console:

Swarm listening on /libp2p-webrtc-star/dns4/star-signal.cloud.ipfs.team/wss/ipfs/QmPp2PjMiGHse2B44M425c4FgzwcJGKbar5J4beck2EKnu
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 Array(0)
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 bitswap:QmPp2PjM:error Failed to provide: DHT is not available +0ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 bitswap:QmPp2PjM:error Error: DHT is not available
    at Object.findProviders (https://unpkg.com/[email protected]/dist/index.min.js:211:26579)
    at Network.findProviders (https://unpkg.com/[email protected]/dist/index.min.js:86:28837)
    at cb (https://unpkg.com/[email protected]/dist/index.min.js:86:28947)
    at nextTask (https://unpkg.com/[email protected]/dist/index.min.js:2:4449)
    at exports.default (https://unpkg.com/[email protected]/dist/index.min.js:2:4825)
    at Network.findAndConnect (https://unpkg.com/[email protected]/dist/index.min.js:86:28927)
    at each (https://unpkg.com/[email protected]/dist/index.min.js:86:25382)
    at https://unpkg.com/[email protected]/dist/index.min.js:8:30560
    at iteratorCallback (https://unpkg.com/[email protected]/dist/index.min.js:8:28791)
    at https://unpkg.com/[email protected]/dist/index.min.js:5:28076 +7ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 bitswap:QmPp2PjM:error Error: DHT is not available
    at Object.findProviders (https://unpkg.com/[email protected]/dist/index.min.js:211:26579)
    at Network.findProviders (https://unpkg.com/[email protected]/dist/index.min.js:86:28837)
    at cb (https://unpkg.com/[email protected]/dist/index.min.js:86:28947)
    at nextTask (https://unpkg.com/[email protected]/dist/index.min.js:2:4449)
    at exports.default (https://unpkg.com/[email protected]/dist/index.min.js:2:4825)
    at Network.findAndConnect (https://unpkg.com/[email protected]/dist/index.min.js:86:28927)
    at each (https://unpkg.com/[email protected]/dist/index.min.js:86:25382)
    at https://unpkg.com/[email protected]/dist/index.min.js:8:30560
    at iteratorCallback (https://unpkg.com/[email protected]/dist/index.min.js:8:28791)
    at https://unpkg.com/[email protected]/dist/index.min.js:5:28076 +4ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 Hello world! - jbf38wqn
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (481ron) true +0ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (3orrus) true +1ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (by09sg) true +0ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (ccc2j) true +0ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (8a6hbb) true +1ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (1hgfma) true +0ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (ohq5x) true +793ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (enq7og) true +1ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (dmmudb) true +1s
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (aglv25) true +0ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (8shc0v) true +4s
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (4rboyj) true +743ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (fniwdt) true +1s
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (6i2v1b) true +10s
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (gicdoi) true +1ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (3orrus) Error: underlying socket has been closed
    at https://unpkg.com/[email protected]/dist/index.min.js:219:7447
    at Array.forEach (<anonymous>)
    at Multiplex.destroy (https://unpkg.com/[email protected]/dist/index.min.js:219:7389)
    at https://unpkg.com/[email protected]/dist/index.min.js:221:13384
    at call (https://unpkg.com/[email protected]/dist/index.min.js:221:13468)
    at Array.forEach (<anonymous>)
    at https://unpkg.com/[email protected]/dist/index.min.js:221:13942
    at f (https://unpkg.com/[email protected]/dist/index.min.js:6:9526)
    at Stream.<anonymous> (https://unpkg.com/[email protected]/dist/index.min.js:221:13177)
    at Stream.f (https://unpkg.com/[email protected]/dist/index.min.js:6:9526) +42s
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (481ron) Error: underlying socket has been closed
    at https://unpkg.com/[email protected]/dist/index.min.js:219:7447
    at Array.forEach (<anonymous>)
    at Multiplex.destroy (https://unpkg.com/[email protected]/dist/index.min.js:219:7389)
    at https://unpkg.com/[email protected]/dist/index.min.js:221:13384
    at call (https://unpkg.com/[email protected]/dist/index.min.js:221:13468)
    at Array.forEach (<anonymous>)
    at https://unpkg.com/[email protected]/dist/index.min.js:221:13942
    at f (https://unpkg.com/[email protected]/dist/index.min.js:6:9526)
    at Stream.<anonymous> (https://unpkg.com/[email protected]/dist/index.min.js:221:13177)
    at Stream.f (https://unpkg.com/[email protected]/dist/index.min.js:6:9526) +0ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 bitswap:QmPp2PjM:error ReceiveError: underlying socket has been closed +1m
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (b1p4jg) true +10s
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (5f50vg) true +1ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (fmobdh) true +6s
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (g9d4h4) true +0ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (9g6swm) true +0ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (3rq3z6) true +0ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (fjk47a) true +760ms
console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js:1 mss:listener   :error (40n84z) true +0ms
kinquestion

Most helpful comment

Ah, good hint. We switched the ipfs.io gateway to different hosts a few weeks ago. The websockets bootstrappers aren't actually used as gateways anymore. And the actual gateways (called scrappy and chappy) likely just can't figure out how to connect to the browser node.

All 10 comments

@konsumer I see you are running with full logs on. The DHT is not available log is because, in fact, the DHT is not turned on by default (still experimenting) and that error comes from https://github.com/libp2p/js-libp2p/blob/master/src/index.js#L91, which is being logged with the whole stack trace making it really scary to look at (todo: improve that log)

The actual issue is that since you removed some of the bootstraper nodes, you now have a probability of hitting the right gateway that your js-ipfs node connected to. I managed to get your app working by adding the full list of bootstrapers again:

    "/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
    "/dns4/sfo-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx",
    "/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3",
    "/dns4/sfo-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z",
    "/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
    "/dns4/sgp-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
    "/dns4/nyc-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm",
    "/dns4/nyc-2.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64"

Note, until we have DHT and Relay on, the node that wants to retrieve content from the browser needs to be connected to it.

I can't seem to to get it to work with those Bootstrap. Here is my demo (which doesn't work for me) with those URLs.

I managed to replicate it locally too.

@lgierth it seems I can get it to 100% work if I ask nodes to pin the hash that is randomly being generated every time the page loads. Did something change between bootstraper and gateway nodes?

Please tell me how I can help debug -- stuff changes all the time so the answer to that would be yes of course

With websockets in particular there've been a number of different reports over the last few weeks, so there definitely is something going on.

@lgierth How to repro:

1) Open https://codepen.io/konsumer/pen/xqNBJX?editors=0010
2) Click the link from "You can find my randomly generated file here!"
3) Wait a bit to see if the Gateway loads (it won't)
4) Go to pinbot, do pin of the hash, see that it loads automatically

Yeah so I'm having this issue too: content isn't available on the gateway once you click that link in the example.

We've been struggling in general to access IPFS content that is created by browser nodes. I did get content available out of the browser by manually connecting to a remote websocket, Go node from the browser ~and pinning though~.

Also, @konsumer gets no DHT is available in the console. I have never gotten that error.

Ah, good hint. We switched the ipfs.io gateway to different hosts a few weeks ago. The websockets bootstrappers aren't actually used as gateways anymore. And the actual gateways (called scrappy and chappy) likely just can't figure out how to connect to the browser node.

The websockets bootstrappers aren't actually used as gateways anymore

This is the main issue. We were under the assumption that there was a direct connection which was the reason why the gateways could indeed fetch things from the browsers. I'll be meeting with Lars today and we will figure a solution for this

Solution for the real issue is being tracked here: https://github.com/ipfs/js-ipfs/issues/973 Closing this one. @lgierth as soon as we get those, I can release another patch version :):)

Was this page helpful?
0 / 5 - 0 ratings