While building the Web Microphone app with IPFS I sumbled upon an error when trying to use older examples but using the latest js-ipfs
:
Error: no valid addresses were provided for transports [WebSockets,WebRTCStar,Circuit]
It got me puzzled but Vasco cleared it out in this thread:
Vasco Santos@vascosantos10@dietrich @ThePatToner @jacobheun @ThePatToner I see that you are trying to listen on a websocket-star address. Unfortunately, we did a poor job on announcing it, but we are no supporting websocket-star addresses since js-ipfs@0.4115:38 PM - 19 May 2020
It turns out that it's necessary to use a new discovery mechanism, webrtc-star
. This seemed like an easy way to fix it, just change the server to the hosted randezvous server mentioned in readme and we're done! But nothing is ever that easy. It was failing for me with a 500 error and I shouldn't be surprised as the documentation clearly states:
it should not be used for apps in production
The recommended route is to deploy it on your own. So I tried to get it done in shortes amount of time and preferably without a need to pay for the whole server. Fortunately, Heroku supports Docker containers now and they can be deployed literally with couple of lines! Here's how you do it:
Instructions
First install the Heroku CLI and then run:
# Login to Heroku
$ heroku login
# Login to the Container Registry
$ heroku container:login
# Clone the webrtc-star repo
$ git clone https://github.com/libp2p/js-libp2p-webrtc-star.git
$ cd js-libp2p-webrtc-star
# Create a Heroku app
$ heroku create
# Build and push the image
$ heroku container:push web
# Release the image to your app
$ heroku container:release web
# Scale to one free worker
$ heroku ps:scale web=1
# Open the app in the browser
$ heroku open
Now the server should welcome you with its address:
Use this address in your IPFS app and you're done!
Top comments (0)