Description



Bug Description
When running Python unit tests that connect to AWS services inside the VS Code Python debugger, I consistently get:
yamlCopyEditssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
-
This error occurs only inside the VS Code debugger
-
The same code works correctly:
-
In PyCharm's debugger
-
From the terminal using
pytest
-
From VS Code's integrated terminal
-
-
Environment variables such as
SSL_CERT_FILE
are set properly and visible inside the test -
ssl.get_default_verify_paths()
reflects the correct certificate bundle -
The problem persists across Python 3.12 and 3.13
-
Downgrading the VS Code Python extension from
2025.8.0
to2025.6.1
does not resolve the issue
Reproduction Steps
-
On macOS 15.5 with Homebrew OpenSSL 3.5.0 installed
-
Create a Python virtual environment using python.org Python 3.12 or 3.13
-
Install
boto3
,certifi
, andpytest
-
Set
SSL_CERT_FILE
to point tocertifi
'scacert.pem
bundle -
Run
pytest
from terminal — works as expected -
Run debugger in VS Code (using the Python extension) — SSL error occurs
Environment Details
What Works
✔ PyCharm debugger runs tests without SSL issues
✔ Running tests from terminal (pytest
) works
✔ VS Code integrated terminal runs tests without issues
What Fails
❌ Running the same tests inside the VS Code Python debugger produces SSL_CERTIFICATE_VERIFY_FAILED
Additional Notes
-
This appears to be related to environment propagation or timing during debugger launch
-
The
debugpy
debugger likely initializes Python'sssl
context before theSSL_CERT_FILE
environment variable is fully applied -
Recent updates to Homebrew OpenSSL 3.5.0 and/or macOS 15.5 may have exposed this behavior
-
Other developers using a similar setup may face this issue without realizing the debugger is the source
Request
Please investigate whether debugpy
or the VS Code Python extension mishandles environment propagation during debugger launch, especially in relation to SSL_CERT_FILE
and Python's ssl
initialization.