Skip to content
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

Struggling with pyngrok to use ngrok https 5000 #19

Open
SnoopLawg opened this issue Jan 25, 2023 · 3 comments
Open

Struggling with pyngrok to use ngrok https 5000 #19

SnoopLawg opened this issue Jan 25, 2023 · 3 comments

Comments

@SnoopLawg
Copy link

Sorry for another created issue, this is more than likely user error than the Repo error, but I am quite new to flask development and seem to be making an error. Again I am very appreciative of what I am learning from this repo after studying so much!

  1. I cloned your repo (on mac) with git clone https://github.com/garettB/shopify-flask-example.git
  2. I updated to python 3.11.1 64 bit located now in /usr/local/bin/python3
  3. I changed the requirements of flask to 2.2.2 in requirements.txt
  4. I installed libraries with pip3 install -r requirements.txt
  5. I then run the server locally by doing python3 src/server.py (Output is that it is running on 3 addresses, two of which ending in 5000 which is the default i believe.
  6. I start a new terminal and install Pyngrok with pip install pyngrok (success)
  7. I then use ngrok http 5000 and I get a errors that I do not understand.

The output error code I will paste below but my question is that was I supposed to create a virtual environment before cloning? Or is this some error with ngrok? I am not very knowledgeable of virtual environments and understand they are to create a clean slate where you install all dependencies, thus creating replicable code on different devices but I wonder if I did something wrong here?

Here is the error code after step 7.

File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 975, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 517, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1075, in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 1346, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyngrok/installer.py", line 117, in install_ngrok
    download_path = _download_file(url, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyngrok/installer.py", line 261, in _download_file
    response = urlopen(url, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 519, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/bin/ngrok", line 33, in <module>
    sys.exit(load_entry_point('pyngrok==5.2.1', 'console_scripts', 'ngrok')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyngrok/ngrok.py", line 517, in main
    run(sys.argv[1:])
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyngrok/ngrok.py", line 503, in run
    install_ngrok(pyngrok_config)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyngrok/ngrok.py", line 100, in install_ngrok
    installer.install_ngrok(pyngrok_config.ngrok_path, pyngrok_config.ngrok_version)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyngrok/installer.py", line 121, in install_ngrok
    raise PyngrokNgrokInstallError("An error occurred while downloading ngrok from {}: {}".format(url, e))
pyngrok.exception.PyngrokNgrokInstallError: An error occurred while downloading ngrok from https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-arm64.zip: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)>
@DSollick
Copy link

Me again -- just searching that last error led me to this: https://stackoverflow.com/questions/69416222/ssl-problem-with-installing-ngrok-through-pyngrok

It's not a flask / python issue so much as a networking one. If you're behind a firewall of some sort (Cisco Umbrella as an example) that URL might be blocked for whatever reason :\

@SnoopLawg
Copy link
Author

Any chance using something else to tunnel would work? Or do I have to figure out what is blocking it?

@DSollick
Copy link

Tunneling would work, presuming they haven't also blocked the tunnel :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants