New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad tunnel name when serving local directories #50
Comments
Thanks for raising this. Have added a test (which currently fails, as expected), will patch this shortly and release a new version either later today or early tomorrow. Thanks for bringing it to my attention! |
…ch perhaps should be renamed in a future breaking release to "addr", since it doesn't HAVE to be a port) can actually be a local directory (ex. "file:///") and ngrok will serve up a fileserver. Added test. - Preparing for 4.1.4 release.
- Address issue #50, where addr (pyngrok's "port" var in connect, which perhaps should be renamed in a future breaking release to "addr", since it doesn't HAVE to be a port) can actually be a local directory (ex. "file:///") and ngrok will serve up a fileserver. Added test. - Preparing for 4.1.4 release. - Updating documentation
Resolved in v4.1.4, which should be available via PyPI soon. |
Thanks for the quick turnaround! The good news is that the error on disconnect() seems to be fixed, but it looks like there is still an error from the ngrok api when using the generated tunnel name:
|
Ah, I see. It looks like perhaps the URI being generated is not properly escaping things when it generates the URL, which make actually be an issue with the underlying In the meantime looks like you have a workaround by passing the |
I haven't dug into it quite far enough myself to see specifically what characters are causing the problem (I assume the / ?). Maybe use a character substitution instead of escaping characters? Worst case, since you are generating a UUID for uniqueness anyway, is to just substitute the word "file" for the port instead of the actual location. |
Alright, definitely looks to be an issue with Therefore, we'll just mitigate this ourselves and avoid the bug by not putting it in the name if it's for a fileserver, as you suggested. Both sides of this bug should now be resolved in 4.1.5. |
Looks good now! Thanks for fixing that so quick. |
Describe the Bug
When tunneling a local directory, the generated name in ngrok.py:163:
"name": name if name else "{}-{}-{}".format(proto, port, uuid.uuid4()
),apparently creates a name that the ngrok api is not able to process correctly, specifically for listing tunnel info or deleting tunnel.
Steps to Reproduce
Above code generates error at disconnect attempt:
pyngrok.exception.PyngrokNgrokHTTPError: ngrok client exception, API returned 404: {"status_code":404,"msg":"Not Found","details":{"path":"/api/tunnels/http-file:///-d207771d-59de-4d1b-838c-b56751d14661 (http)"}}
Using the api directly with the generated URI to get tunnel info:
http://127.0.0.1:4040/api/tunnels/http-file:%2F%2F%2F-d207771d-59de-4d1b-838c-b56751d14661
results in:
Removing the "port" portion of the name fixes it:
Expected Behavior
ngrok.disconnect() should not generate errors with a valid public_url
Environment
pyngrok
Version: 4.1.3Additional Context
N/A
The text was updated successfully, but these errors were encountered: