Search code examples
pythongoogle-colaboratorystreamlitpyngrok

Tunnel not found error Pyngrok streamlit collab


I was developing an ui in streamlit and using pyngrok from Colab. everything was working fine till few days earlier the tunnel not found error started occurring. I am using below code. I have also upgraded pyngrok and tried but same problem persisted. Fairly new to the whole UI building and Colab pyngrok seemed most convenient way to learn. But now that this stopped working if anyone can suggest any other methods too or what am doing wrong that would be great


!pip install streamlit
!pip install pyngrok==4.1.1
import streamlit as st
from pyngrok import ngrok
# !ngrok authtoken (mykey)

# writefile app.py

def main():
  # app body
  pass

if __name__=='__main__':
  main()

!streamlit run app.py &>/dev/null&
public_url = ngrok.connect(port='8501')
public_url


#the log is also attached below after running above code which runs without errors as can be seen
#output below
2021-01-30 09:30:44.197 INFO    pyngrok.process: ngrok process starting: 1106
2021-01-30 09:30:44.218 INFO    pyngrok.process: t=2021-01-30T09:30:44+0000 lvl=info msg="no configuration paths supplied"

2021-01-30 09:30:44.220 INFO    pyngrok.process: t=2021-01-30T09:30:44+0000 lvl=info msg="using configuration at default config path" path=/root/.ngrok2/ngrok.yml

2021-01-30 09:30:44.224 INFO    pyngrok.process: t=2021-01-30T09:30:44+0000 lvl=info msg="open config file" path=/root/.ngrok2/ngrok.yml err=nil

2021-01-30 09:30:44.227 INFO    pyngrok.process: t=2021-01-30T09:30:44+0000 lvl=info msg="starting web service" obj=web addr=127.0.0.1:4040

2021-01-30 09:30:45.021 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg="tunnel session started" obj=tunnels.session

2021-01-30 09:30:45.026 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg="client session established" obj=csess id=a37f21d64392

2021-01-30 09:30:45.031 INFO    pyngrok.process: ngrok process has started: http://127.0.0.1:4040
2021-01-30 09:30:45.044 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=start pg=/api/tunnels id=39c5cfa99a0ab7d7

2021-01-30 09:30:45.051 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=end pg=/api/tunnels id=39c5cfa99a0ab7d7 status=200 dur=386.416µs

2021-01-30 09:30:45.057 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=start pg=/api/tunnels id=9e57507bfe0794a8

2021-01-30 09:30:45.059 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=end pg=/api/tunnels id=9e57507bfe0794a8 status=200 dur=159.931µs

2021-01-30 09:30:45.063 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=start pg=/api/tunnels id=121fc98244651186

2021-01-30 09:30:45.418 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg="started tunnel" obj=tunnels name="http-8501-b9a57eaf-a9ac-4dd9-be80-7b1a5e4af344 (http)" addr=http://localhost:8501 url=http://c25e18c565f2.ngrok.io

2021-01-30 09:30:45.422 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg="started tunnel" obj=tunnels name=http-8501-b9a57eaf-a9ac-4dd9-be80-7b1a5e4af344 addr=http://localhost:8501 url=https://c25e18c565f2.ngrok.io

2021-01-30 09:30:45.428 INFO    pyngrok.process: t=2021-01-30T09:30:45+0000 lvl=info msg=end pg=/api/tunnels id=121fc98244651186 status=201 dur=374.833924ms

http://c25e18c565f2.ngrok.io

Error:

enter image description here


Solution

  • I am the developer of pyngrok, and I wanted to reach out to let you know that I've seen reports of this pop up on our issue tracker, several on here, on Colab's issue tracker, etc. a lot in the last week. I reached out to ngrok, as that appeared to be where the issue was, and they just got back to me. They confirmed that they had inadvertently started blocking connections to Colab recently, and they have now fixed this. I just tested this again myself as well, and sure enough, it's fixed!