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

[CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate #370

Open
tin-ot opened this issue Oct 17, 2024 · 1 comment

Comments

@tin-ot
Copy link

tin-ot commented Oct 17, 2024

nodeenv --version
1.9.1

python -V
Python 3.12.3

pip install certifi --force
Successfully installed certifi-2024.8.30

sudo apt update
sudo update-ca-certificates

ln -s /etc/ssl/certs/ca-certificates.crt "$VIRTUAL_ENV/lib/python3.12/site-packages/certifi/cacert.pem" -f

Traceback (most recent call last):
File "/home/bob/venv/bin/nodeenv", line 8, in
sys.exit(main())
^^^^^^
File "/home/bob/venv/src/nodeenv/nodeenv.py", line 1139, in main
args.node = get_last_stable_node_version()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bob/venv/src/nodeenv/nodeenv.py", line 1073, in get_last_stable_node_version
return _get_last_node_version()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bob/venv/src/nodeenv/nodeenv.py", line 1066, in _get_last_node_version
for v in _get_versions_json() if version_filter(v)), None)
^^^^^^^^^^^^^^^^^^^^
File "/home/bob/venv/src/nodeenv/nodeenv.py", line 1028, in _get_versions_json
response = urlopen('%s/index.json' % src_base_url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bob/venv/src/nodeenv/nodeenv.py", line 652, in urlopen
return urllib2.urlopen(req)
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 215, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 515, in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 532, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 1392, in https_open
return self.do_open(http.client.HTTPSConnection, req,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 1347, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1000)>

@tin-ot
Copy link
Author

tin-ot commented Mar 4, 2025

This issue was due to the fact that I use a network that has an SSL decryption layer of security.

Some packages don't use system ca trusted cert.
Thus the cert appears has an untrusted during the handshake.

It was fixed by add both those environment variables (on ubuntu):

export REQUESTS_CA_BUNDLE='/etc/ssl/certs/ca-certificates.crt'
export NODE_EXTRA_CA_CERTS='/etc/ssl/certs/ca-certificates.crt'

This issue can be closed

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

1 participant