# JS-IPFS The dial request has no valid addresses on ipfs.swarm.connect

**URL:** <https://discuss.ipfs.tech/t/js-ipfs-the-dial-request-has-no-valid-addresses-on-ipfs-swarm-connect/14873>\
**Category:** Help\
**Created:** [July 29, 2022, 4:46pm UTC](https://discuss.ipfs.tech/t/js-ipfs-the-dial-request-has-no-valid-addresses-on-ipfs-swarm-connect/14873 "2022-07-29T16:46:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BL-EVER](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/bl-ever/32/6763_2.png) [@BL-EVER](https://discuss.ipfs.tech/u/BL-EVER)\
**Post date:** [July 29, 2022, 4:46pm UTC](https://discuss.ipfs.tech/t/js-ipfs-the-dial-request-has-no-valid-addresses-on-ipfs-swarm-connect/14873/1 "2022-07-29T16:46:36Z")

</div>

I am trying to connect my js-ipfs node in the browser to the kubo node running in docker. When I call await ipfs.swarm.connect(new Multiaddr(‘/ip4/127.0.0.1/tcp/4003/ws/p2p/DOCKER-KUBO-NODE-ID’));  
I get the following error: Error: The dial request has no valid addresses.  
Any help ?  
In kubo config under swarm I appended “/ip4/127.0.0.1/tcp/4003/ws” and mapped the port in docker  
I am trying to fetch a file from kubo in js-ipfs

---

<div class="post-metadata">

**Author:** ![haydenyoung](https://avatars.discourse-cdn.com/v4/letter/h/a8b319/32.png) [@haydenyoung](https://discuss.ipfs.tech/u/haydenyoung)\
**Post date:** [September 7, 2022, 8:41pm UTC](https://discuss.ipfs.tech/t/js-ipfs-the-dial-request-has-no-valid-addresses-on-ipfs-swarm-connect/14873/2 "2022-09-07T20:41:40Z")

</div>

I ran into the same problem. Turns out you can’t add localhost as a peer unless you stop IPFS from filtering out local connections (which it deems insecure).

More details are provided at [How to connect from IPFS node in browser to IPFS node in terminal? · Issue #4185 · ipfs/js-ipfs · GitHub](https://github.com/ipfs/js-ipfs/issues/4185).

---

<div class="post-metadata">

**Author:** ![danieln](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/danieln/32/6408_2.png) [@danieln](https://discuss.ipfs.tech/u/danieln)\
**Post date:** [September 8, 2022, 3:36pm UTC](https://discuss.ipfs.tech/t/js-ipfs-the-dial-request-has-no-valid-addresses-on-ipfs-swarm-connect/14873/3 "2022-09-08T15:36:25Z")

</div>

As @haydenyoung mentioned, you need to explicitly allow all WebSocket connections as follows:

```nohighlight
import { WebSockets } from '@libp2p/websockets'
import { create } from 'ipfs-core'
import { all } from '@libp2p/websockets/filters'

window.addEventListener('load', async () => {

  const ws = new WebSockets({
    // 👇 allow all WebSocket connections 
    filter: all,
  })
  const ipfs = await create({
    libp2p: {
      transports: [ws],
    },
  })
  // --------------------------------------------- 👇 note that this should be ws. wss is only supported for
  await ipfs.swarm.connect('/ip4/127.0.0.1/tcp/4003/ws/p2p/{peerId of the node running in the terminal}')
})

```

By default, the WebSocket transport filters out `localhost` WebSocket connections. This is because older versions of js-libp2p would gossip about their localhost addresses which often leads to js-ipfs attempting to connect to other peers’ `localhost` multi-address unsuccessfully.

You can find more context in this issue: [feat: custom address filter by vasco-santos · Pull Request #116 · libp2p/js-libp2p-websockets · GitHub](https://github.com/libp2p/js-libp2p-websockets/pull/116)
