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

Error: no valid addresses were provided for transports #2779

Closed
icidasset opened this issue Feb 15, 2020 · 37 comments
Closed

Error: no valid addresses were provided for transports #2779

icidasset opened this issue Feb 15, 2020 · 37 comments
Labels
topic/libp2p Topic libp2p

Comments

@icidasset
Copy link
Contributor

👋 Thanks for the 0.41.0 update!

I'm having an issue with upgrading from 0.38
I'm getting the following error:

Error: no valid addresses were provided for transports [WebSockets,WebRTCStar,Circuit]

I'm setting it up as follows, which worked before the upgrade:

const ipfs = await Ipfs.create();
await ipfs.swarm.connect("/dns4/ipfs.runfission.com/tcp/4003/wss/ipfs/QmVLEz2SxoNiFnuyLpbXsH6SvjPTrHNMU88vCQZyhgBzgw")

Any thoughts on what changed?

@alanshaw
Copy link
Member

alanshaw commented Feb 15, 2020

Are you running in Node.js or the browser or somewhere else? What swarm addresses do you have configured? ipfs.config.get(‘Addresses.Swarm’). I’m guessing you have a websocket-star address or something in there.

@alanshaw alanshaw added the topic/libp2p Topic libp2p label Feb 15, 2020
@icidasset
Copy link
Contributor Author

I found the "issue" 😅

I'm connecting to a peer (swarm) after I called create. But, I got the error immediately after calling create without any configuration (ie. just Ipfs.create())

If I pass an empty swarm list to create, as follows, it does work:

Ipfs.create({ config: { Addresses: { Swarm: [] } } })
await ipfs.swarm.connect(...)

Previously I didn't have to pass this empty list to create. What do you think @alanshaw? Is the new behaviour better, is this confusing, is this just edge-case, or am I not using this as intended?

Thanks ✌️

PS. I'm running this in the browser using the minified unpkg distribution.

@alanshaw
Copy link
Member

alanshaw commented Mar 2, 2020

I think by using that config you removed the websocket-star address you previously had saved in Addresses.Swarm so there was no longer an address without a transport.

@jacobheun do you think this startup error should be downgraded to a warning?

@jacobheun
Copy link
Contributor

@alanshaw yes, I think so, this shouldn't be a fatal error. The available startup addresses don't have any transports so it will fail to connect, however, performing a manual connect will still work.

The important thing to note is that your node will be dial only.

We need to make this a configurable option in libp2p in case people want the overt error, but we can configure js-ipfs (node, browser or both) to be more lenient. I created an issue in libp2p, libp2p/js-libp2p#575, to track this.

@woss
Copy link

woss commented Mar 11, 2020

im having this issue in 0.41.2 version. what is the solution, how can i use swarm addresses?

@vasco-santos
Copy link
Member

FYI, I will be working on the libp2p/js-libp2p#575 next week. We aim to get a better explanation for this error and configure it to be more lenient.

@woss regarding your issue. You are probably using a websocket-star address, which we do not support anymore. Since it it possibly the unique multiaddr you are providing, it will fail to listen in any of the libp2p transports.

For now, if you want to use ipfs in a browser environment, you should rely on webrtc-star. Over the next months, I plan to work on other solutions for improving ipfs connectivity in tge browser.

@5310
Copy link

5310 commented May 15, 2020

@vasco-santos on a small tangent, is there any way to tell if the /dns4/star-signal.cloud.ipfs.team/wss/p2p-webrtc-star webrtc-star signalling dev-server is alive or not?

@achingbrain
Copy link
Member

@5310 you should try to connect to it and handle the failure if it doesn't work. Better yet, stand up your own signalling server which you can guarantee is available, not under heavy load, etc and use that.

Take a look at the webrtc-star readme: https://github.com/libp2p/js-libp2p-webrtc-star#rendezvous-server-aka-signalling-server

@vasco-santos
Copy link
Member

@5310 as @achingbrain recommended, the best solution is to run your own signalling server. We want to update the available public signalling servers and increase their redundancy, but they should only be used for demos and examples purposes, since there is no guarantee on availability.

@5310
Copy link

5310 commented May 18, 2020

Right now I do have a local WebRTC-Star signaling server that I use for testing. But the public server was pretty nifty for Codepen demos. I've actually not caught it up even once all year, even though it seemed to not have been discontinued just yet from the docs.

The existence of WebRTC-Stardust also made things a bit confusing, but I guess it's not ready yet. Will try to host a remotely accessible signaling server for my demos. 👍

@jacobheun
Copy link
Contributor

As part of this we need to get a webrtc-star server deployed to replace the websocket-star server, tracking this at libp2p/js-libp2p-webrtc-star#180.

@lazyweirdo
Copy link

Hello, i have the same issue ... upgrading from 0.40.0 to latest version this simple code does not work anymore ...

<!doctype html>
<html>
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.js"></script>
  </head>
  <body id="body"></body>
</html>
<script type="text/javascript">
  let node = null;
  window.onload = async () => {
    node = await Ipfs.create({
      "EXPERIMENTAL" : { "pubsub":true },
      "repo" : "repo-" + Date.now(),
      "config":{
      "Addresses":{
        "Swarm":["/dns4/ipfs.runfission.com/tcp/4003/wss/ipfs/QmVLEz2SxoNiFnuyLpbXsH6SvjPTrHNMU88vCQZyhgBzgw"]
        }
      }
    });
  };
</script>

Thrown errors are:

index.js:48 Uncaught (in promise) Error: no valid addresses were provided for transports [WebSockets,WebRTCStar,Circuit]
    at TransportManager.listen (index.js:48)
    at Libp2p._onStarting (index.js:1591)
    at Libp2p.start (index.js:1422)
    at Proxy.start (semver.js:1087)
    at async window.onload (ipfs.html:12)
listen	@	index.js:48
_onStarting	@	index.js:1591
start	@	index.js:1422
start	@	semver.js:1087
async function (async)		
start	@	semver.js:1066
create	@	abstract-iterator.js:36
async function (async)		
create	@	abstract-iterator.js:31
window.onload	@	ipfs.html:12
load (async)		
(anonymous)	@	ipfs.html:11

and

Uncaught (in promise) Error: no valid addresses were provided for transports [WebSockets,WebRTCStar,Circuit]
    at TransportManager.listen (index.js:48)
    at Libp2p._onStarting (index.js:1591)
    at Libp2p.start (index.js:1422)
    at Proxy.start (semver.js:1087)
    at async window.onload (ipfs.html:12)
listen	@	index.js:48
_onStarting	@	index.js:1591
start	@	index.js:1422
start	@	semver.js:1087
async function (async)		
window.onload	@	ipfs.html:12
load (async)		
(anonymous)	@	ipfs.html:11

The exact same code works fine with 0.40.0 ... Do i have to change something in order to make it work now ?

@icidasset 's solution didn't work for me ...
@alanshaw i change the repo every time it runs, thus Addresses.Swarm should not have any old garbage, am i correct ?

One more question ...do you know about any other public node with wss relay capability enabled ??
runfission's seems to be the only one around ...
We should have a public list just as the public gateway list ... at least for now, till AutoRelay is fully supported in js-ipfs ... it is a key feature for serverless web apps, it is pointless to run your own, i mean, there is no difference between that and to have a classic server to which your web app is going to connect ... your server is down, bam, your app does't work anyway ... we should run one, and share it to be used among other shared relays, then if yours is down, your web app still can connect to others ...
@vasco-santos Should i create a PR here https://github.com/ipfs/public-gateway-checker for such a list ?
Should i create it somewhere else ?
A simple "yes do it" or "DON'T" would be really really appreciated ...
I would also like to create a list for public signaling/rendezvous servers, at least for webrtc because websocket-star is going to be deprecated, and replaced by stardust, or i don't know, it is confusing, things change so fast ...

@bmann
Copy link

bmann commented May 28, 2020

@lazyweirdo yeah we’d be glad of a network of wss relays.

Just talked to the Qri folks this morning, I’ll ask them if this is of interest.

Please ping me wherever you open an issue and I’ll coordinate Fission’s side of things.

@lazyweirdo
Copy link

Please ping me wherever you open an issue and I’ll coordinate Fission’s side of things.

@bmann nice ! ... i'll pin you :)

@vasco-santos
Copy link
Member

vasco-santos commented Jun 2, 2020

@vasco-santos Should i create a PR here https://github.com/ipfs/public-gateway-checker for such a list ?

I did not know this repo. I think it is related to public gateways. What if you create a repo specific for signalling servers? This way, we could track for now the webrtc-star and stardust signal server and the deployed versions. If you do it, we should reference it from the webrtc-star and stardust modules, as well as browser examples in js-ipfs and js-libp2p

@vasco-santos
Copy link
Member

FYI we are working on getting some webrtc-star signal servers. We can then sync on having a repo with all the signal servers that people can use like the public-gateway-checker

@lazyweirdo
Copy link

FYI we are working on getting some webrtc-star signal servers. We can then sync on having a repo with all the signal servers that people can use like the public-gateway-checker

Nice ... let me know if you create a repo for this, I would like to contribute ... If i got enough time, i would do it ... maybe one of these days

achingbrain pushed a commit that referenced this issue Jun 22, 2020
On `js-ipfs@0.41`, we removed the `websocket-star` module from the libp2p default configuration for browser nodes in `js-ipfs`. We removed it because this module was not refactored during #1670, since the libp2p goal is to [sunset the star protocols](libp2p/js-libp2p#385) and we preferred to use the time refactoring `websocket-star` into improving the browser support.

In the refactor, the `webrtc-star` module was refactored so that browser users could discover other peers in the network. In addition, `circuit-relay` may be used for establishing connections between browser nodes using `websockets`.

However, this migration has not been smooth for `js-ipfs` users. Users previously using `websocket-star` swarm addresses, did not have enough visibility of this change, since the removal of `websocket-star` was transparent for them and on the default `js-ipfs` release and not technically a programmable breaking change. 

With the above in mind, once `js-ipfs` users updated they started getting errors from `js-libp2p` in scenarios where they were providing only `websocket-star` swarm addresses. When `js-libp2p` receives listening multiaddrs, it throws an error if it cannot use any to listen on the configured transports, which was the case here (For instance #2779).

In `js-libp2p`, we added an option to tolerate these errors [libp2p/js-libp2p#643](libp2p/js-libp2p#643), which was also mentioned for some other cases earlier.

After syncing about this issue, we decided to temporarily throw an error when `js-ipfs` receives `websocket-star` multiaddrs. This aims to help users who still need to migrate to identify the problem faster.
@vasco-santos
Copy link
Member

Hey folks! 👋
We already have some webrtc-star servers that can be used for experiments/demos. Do not use them in production as availability is not guaranteed.

https://wrtc-star1.par.dwebops.pub/
https://wrtc-star2.sjc.dwebops.pub/

We also have both instances up via a round-robin DNS at https://webrtc-star.discovery.libp2p.io . Bear in mind that using this one might result in not discovering peers that went to the other server. But for some use cases, it can be enough and offers more reliability.

Let me know if you need any help on integrating this and I will be working on updating the browser example for IPFS and libp2p.

@geolffreym
Copy link

geolffreym commented Jun 29, 2020

i am self wrtc deployed server and getting same issue no valid addresses were provided for transports [WebSockets,WebRTCStar,Circuit] https://secure-beyond-12878.herokuapp.com/ @vasco-santos am i have something wrong?{ start: true, preload: {enabled: false}, repo: path.join(rootDir, '/ipfs'), relay: {enabled: true, hop: {enabled: true, active: true}}, EXPERIMENTAL: {pubsub: true}, config: { Swarm: [ '/dns4/secure-beyond-12878.herokuapp.com/tcp/443/wss/p2p-webrtc-star/' ], API: '/ip4/127.0.0.1/tcp/5002', Gateway: '/ip4/127.0.0.1/tcp/9090' }, Discovery: { MDNS: { Enabled: true, Interval: 10 }, webRTCStar: { Enabled: true } } }

@icidasset
Copy link
Contributor Author

@geolffreym Swarm should be under config: { Addresses: { ... }} instead of { config : ... }

Also, thanks everyone, I can confirm that everything works as expected now.
I do wish the error messages were a bit clearer, but grateful nonetheless 🙏

@geolffreym
Copy link

geolffreym commented Jun 29, 2020

@icidasset sorry my bad, i post wrong conf. => this is the current i am using { start: true, repo: 'source/ipfs', preload: {enabled:false}, relay: {enabled: true, hop: {enabled: true, active: true}}, EXPERIMENTAL: {pubsub: true}, config: { Addresses: { Swarm: [ '/dns4/secure-beyond-12878.herokuapp.com/tcp/443/wss/p2p-webrtc-star/' ], API: '/ip4/127.0.0.1/tcp/5002', Gateway: '/ip4/127.0.0.1/tcp/9090' }, Discovery: { MDNS: { Enabled: true, Interval: 10 }, webRTCStar: { Enabled: true } } } }

@vasco-santos
Copy link
Member

@geolffreym Can you try /dns4/secure-beyond-12878.herokuapp.com/tcp/80/ws/p2p-webrtc-star/?

If you access http://secure-beyond-12878.herokuapp.com, that's the address that should be used to listen on

@geolffreym
Copy link

geolffreym commented Jun 29, 2020

Actually @vasco-santos trying with tcp/80/.. maybe i need set certs to use wss right?

@vasco-santos
Copy link
Member

Oh I see, I did not realize you were adding wss. Yes, for wss you will need to configure certificates

@vasco-santos
Copy link
Member

You can read more on how to configure them on discuss.libp2p. Meanwhile, you should be able to use with ws

@geolffreym
Copy link

i really thank u @vasco-santos ... thanks everyone too!! i let u know about it!!

@geolffreym
Copy link

Captura de Pantalla 2020-06-29 a la(s) 13 20 16 @vasco-santos

@geolffreym
Copy link

it can be that heroku is making a redirect to https? Maybe?

@vasco-santos
Copy link
Member

@geolffreym it seems that you are running it in a node environment now.
As you can see from the error, no address for listen were provided for TCP/websockets/Circuit per the default configuration: https://github.com/ipfs/js-ipfs/blob/master/packages/ipfs/src/core/runtime/libp2p-nodejs.js#L21-L24, while browser environment has https://github.com/ipfs/js-ipfs/blob/master/packages/ipfs/src/core/runtime/libp2p-browser.js#L20-L22 by default.

If you want to connect a browser node, with a node.js node, you will need to make a custom config for libp2p in IPFS. Basically, add the webrtc-star transport to the transports.

cc @achingbrain should we add it by default in node? What do you think?

@geolffreym
Copy link

ohhh right!! Got it.. I assumed that js-ipfs did it by itself, thanks for the clarification @vasco-santos

@geolffreym
Copy link

Anybody with same issue in node here is a cool example to customize libp2p in IPFS https://github.com/ipfs/js-ipfs/blob/bf92fb321a66651a63a8b9cc81112f149573826a/examples/custom-libp2p/index.js @vasco-santos thanks again!!

@geolffreym
Copy link

geolffreym commented Jun 30, 2020

@jacobheun is there any updated version of this example => link i think last versions is not supporting peerInfo anymore i get cannot get id of undefined? How could i support js-ipfs peer discovering using electron node environment @achingbrain ? 2 days ago were working fine with multiaddress /dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star/ know i get Error: no valid addresses were provided for transports [TCP,WebSocket,Circuit], i already tried customizing libp2p and i was not lucky using webrtc-star and electronWrtc module.. CC @vasco-santos

@jacobheun
Copy link
Contributor

@geolffreym the latest version of ipfs, 0.47 is up to date, https://github.com/ipfs/js-ipfs/blob/ipfs%400.47.0/examples/custom-libp2p/index.js. The version you're linking to is older.

For customizing libp2p in Node.js there is an example of a setup using WebrtcStar, Websockets and TCP at https://github.com/libp2p/js-libp2p-examples/blob/libp2p-0.28.x/chat/nodejs/08-End/index.js#L35. In particular you can pass params, like the wrtc module to the webrtc transport via configuration https://github.com/libp2p/js-libp2p-examples/blob/libp2p-0.28.x/chat/nodejs/08-End/index.js#L43-L47. This will allow you to avoid creating the transports by hand.

@geolffreym
Copy link

Yay!!!! i really thank u.. on it!!! @jacobheun

@geolffreym
Copy link

geolffreym commented Jun 30, 2020

@jacobheun Swarm listening on /dns4/secure-beyond-12878.herokuapp.com/tcp/80/ws/p2p-webrtc-star/p2p/Qmdwv74aePUnjZVsw7xMwbUhT1auhBVrdahnNwNd1mhHtn Swarm listening on /dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star/p2p/Qmdwv74aePUnjZVsw7xMwbUhT1auhBVrdahnNwNd1mhHtn think is working :) thanks CC @vasco-santos

@geolffreym
Copy link

geolffreym commented Jun 30, 2020

For anyone who has a problem similar to mine, here is my p2p settings. My problem if it was that I needed to connect nodes from different environments using node to emit data and the browser to obtain it, I managed to solve it with the help of everyone, thank you very much. In the same way I leave here the link to deploy your own webrtc signaling server
https://suda.pl/free-webrtc-star-heroku/

CC @vasco-santos @jacobheun

const Libp2p = require('libp2p')
const wrtc = require('wrtc')
const WebrtcStar = require('libp2p-webrtc-star')
const Bootstrap = require('libp2p-bootstrap')
const Gossipsub = require('libp2p-gossipsub')
const KadDHT = require('libp2p-kad-dht')
const MPLEX = require('libp2p-mplex')
const SECIO = require('libp2p-secio')

module.exports = (opts) => {
    // Set convenience variables to clearly showcase some of the useful things that are available
    const peerId = opts.peerId;
    const bootstrapList = opts.config.Bootstrap;

    // Build and return our libp2p node
    return new Libp2p({
        peerId,
        addresses: {
            listen: [
                //'/ip4/0.0.0.0/tcp/4002',
                '/dns4/secure-beyond-12878.herokuapp.com/tcp/443/wss/p2p-webrtc-star/',
                //'/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star/',
                //'/dns4/wrtc-star2.sjc.dwebops.pub/tcp/443/wss/p2p-webrtc-star/'
            ]
        },
        // Lets limit the connection managers peers and have it check peer health less frequently
        connectionManager: {
        	minPeers: 25,
        	maxPeers: 100,
        	pollInterval: 5000
        },
        modules: {
            transport: [WebrtcStar],
            streamMuxer: [MPLEX],
            connEncryption: [SECIO],
            peerDiscovery: [Bootstrap],
            dht: KadDHT,
            pubsub: Gossipsub
        },
        config: {
            transport: {
                [WebrtcStar.prototype[Symbol.toStringTag]]: {
                    wrtc
                }
            },
            peerDiscovery: {
                autoDial: true,
                webRTCStar: {
                    enabled: true
                },
                bootstrap: {
                    enabled: true,
                    interval: 30e3,
                    list: bootstrapList
                }
            },
            relay: {
                enabled: true,
                hop: {
                    enabled: true,
                    active: true
                }
            },
            dht: {
                enabled: true,
                randomWalk: {
                    enabled: true,
                }
            }
        }
    })
}

achingbrain pushed a commit that referenced this issue Jul 1, 2020
Per #2779 , this PR adds the public webrtc servers to the browser example.

This allows users to run easily the example, but also provides information for how users should use a signaling server for production.
@jacobheun
Copy link
Contributor

Closing this as this should no longer be a problem and configuration options were provided in previous comments.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/libp2p Topic libp2p
Projects
None yet
Development

No branches or pull requests

10 participants