Error when running js-libp2p-webrtc browser-to-browser example: "stream ended before 1 bytes became available"

Hello Libp2p Community,

I am currently experiencing an issue when trying to run the js-libp2p-webrtc example (browser-to-browser):

When I attempt to connect to the relay server using the address provided by clicking the “Connect” button, I receive the following error in the JavaScript console:

upgrader.ts:625 Uncaught (in promise) CodeError: Error: stream ended before 1 bytes became available
    at DefaultUpgrader._encryptOutbound (upgrader.ts:625:13)
    at async DefaultUpgrader.upgradeOutbound (upgrader.ts:304:13)
    at async WebSockets.dial (index.ts:49:18)
    at async DefaultTransportManager.dial (transport-manager.ts:123:14)
    at async queue.add (dial-queue.ts:445:28)
    at async index.js:118:36

Here are the steps I followed:

  1. I start the relay server using the npm run relay command, which provides me with the following output:
> js-libp2p-webrtc-private-to-private@1.0.0 relay
> node relay.js

p2p addr:  [
  1. I then run the example and enter the address provided by the relay server into the input field on the page (/ip4/, and click “Connect”.

This is when the error occurs. I’d greatly appreciate any insight or suggestions on how to resolve this issue. I’m trying to get the example working because I aim to implement peer 2 peer chat functionality into my browser app.

Sorry for the late reply, but perhaps it will help someone else.

I was getting the same error messages when connections were being closed on the Kubo side by the Resource Manager. Perhaps try disabling (or re-configuring) the Resource Manager. Also, be sure to run Kubo with debug logging enabled and see what you get on that side.