Peer Routing From the Browser Possible Without Delegation?

I’m making an attempt at trying to connect to a remote Kubo node from a JS-libp2p node in my browser.

I am aware that the recommended way for browser nodes to carry out peer routing is to use the delegated peer routing method, but I don’t want to rely on a static IP location of my Kubo node or setting up the http end point with SSL security.

My goal is to have the Kubo and browser nodes connect to the network through the default bootstrap nodes, and then have the browser node query its peers for the location of my Kubo node. This seems like it might be possible as I found a quote from 2020 from a contributor that seems to imply it was possible even back then and may have been improved on by now: Js-libp2p "peer and content routing" / kad-dht example - #2 by vasco-santos

Please note that there are known problems and the js DHT in the browser is not stable at all in the moment. Also, go DHT had significant improvements over the last year and we will be working on porting these changes to js and improve the general state of the DHT across different environments soon. If you are testing it, you should use its client mode and rely on go nodes to make DHT queries for now.

I’m not sure if it’s actually not possible or if I’m doing something wrong in my browser node’s configuration (which is just the config taken from the “libp2p-in-the-browser”):

      // transports allow us to dial peers that support certain types of addresses
      transports: [
          // use content routing to find a circuit relay server we can reserve a
          // slot on
          discoverRelays: 1
      connectionEncryption: [noise()],
      streamMuxers: [yamux(), mplex()],
      peerDiscovery: [
          list: [
      services: {
          // the identify service is used by the DHT and the circuit relay transport
          // to find peers that support the relevant protocols
          identify: identifyService(),
          // the DHT is used to find circuit relay servers we can reserve a slot on
          dht: kadDHT({
              // browser node ordinarily shouldn't be DHT servers
              clientMode: true

And I’m asking the network with the following function call:

  const findPeer = async () => {
      let peerId = await createFromJSON({id: 'libp2pnodeidstring'})
      let peer = await $libp2p.peerRouting.findPeer(peerId)
      return peer   

It seems to search for a few seconds and then throws an error, Uncaught (in promise) CodeError: Not found

Any suggestions are appreciated!

Hi, I have sort of the same question and found another post which was asking sort of the same question. For short I think it was not possible to connect from helia nodes to kubo nodes. But please read my full answer from another post in the helia section of this universe: Using Kubo as middleman for browser Helia nodes - #2 by silkroadnomad - Help - IPFS Forums