Cannot complete ngrok tunnel connection on google colab

6.2k views Asked by At

I am trying to run ngrok and establish a connection on google colab. The code runs fine but I get the following error,

The connection to http://7f319cc47f9f.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:80.

Make sure that a web service is running on localhost:80 and that it is a valid address.

The error encountered was: dial tcp 127.0.0.1:80: connect: connection refused

Now I am fairly new to ngrok and have little knowledge about how the servers work. So if any of you have a solution to this please give me a step by step solution. Also, I heard running the server fixes the problem but I am yet to find out how. I used port 8051.

2

There are 2 answers

0
alexdlaird On

You are tunneling to port 80, but nothing is running there. As you mentioned port 8051, I assume that's where you mean to be tunneling. It seems you're using pyngrok, so according to the docs you would specify a port other than the default 80 like so:

ngrok.connect(8051)
0
Shaina Raza On

In colab use localtunnel as

!streamlit run /content/sparknlp_ner_playground.py & npx localtunnel --port 8503