Closed omerXfaruq closed 2 weeks ago
Please rerun your script with console debug logs enabled, and provide the full output in this ticket.
Example of your script with debug logging enabled:
from pyngrok import ngrok
# Setup a logger
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s"))
logger.addHandler(handler)
ngrok.set_auth_token("TOKEN")
ssh_url = ngrok.connect(22, "tcp")
print("ssh_url: " + ssh_url)
Hi
I've checked the logs and didn't find anything wrong. Then I tried another port and tested the tcp tunnel with netcat, it worked without issues.
I'll check my ssh server side of the things as I can see that tcp tunnel works fine. Thanks.
Though it's still confusing because the ssh tunnel suddenly stopped working, had no changes in the system. Will troubleshoot write my findings.
Is ufw
or some other firewall intercepting the usage of ngrok
? There is a nightly build that uses ubuntu-latest
, which it appears GitHub runners call 22.04 (so 24.04 isn't yet tested, it seems), if you can confirm this is the same version you're on. Perhaps you can look in to how your use case differs environmentally from the nightly integration tests, here's one SSH example?
This run is from a branch that manually points GitHub to use 24.04 runners, which also succeeded: https://github.com/alexdlaird/pyngrok/actions/runs/9664659444
Thanks, and yes I confirm, just tested with another ubuntu system and pyngrok works fine. It seems the problem is with my specific system.
So when I use nc through local network or ngrok tunnel, the message is delivered. But when I use pyngrok tunnel it's not. So I don't think it's a problem with the firewall. I tried creating new virtual environments as well, but didn't help. I'll try to use a different python version and see how it goes.
Also until 1-2 weeks ago I was using pyngrok to access remotely without any issues, but it suddenly started to create problems, that's why it's strange. I'll investigate more.
Acknowledgements
pyngrok
's documentation for an answerOperating System
tried on macos and ubuntu
Python Version
3.12.3
pyngrok Version
7.1.6
Describe the Bug
This week my ssh tunnel created by pyngrok stopped working. I've created a fresh virtual environment and installed the latest version of pyngrok but the problem still persists.
Steps to Reproduce
Then ssh into the tunnel from your terminal.
Expected Behavior
It should connect with ssh without any issues but it's giving an error:
$ ssh -p 12821 username@6.tcp.ngrok.io Connection closed by 3.141.177.1 port 12821