microsoft / microsoft/vscode-python-debugger

SSL_CERTIFICATE_VERIFY_FAILED in VS Code Python Debugger on macOS, Terminal and PyCharm Work Fine

Đang mở
#743 6 bình luận 0 reaction 1 người được giao Xem trên GitHub

@eleanorjboyd đang làm issue này rồi.

Từ ngày 2/7/2025.

triage-needed
Ngôn ngữ chính
TypeScript
Star
181
Fork
126
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
3

Mô tả

Image Image Image
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 to 2025.6.1 does not resolve the issue


Reproduction Steps
  1. On macOS 15.5 with Homebrew OpenSSL 3.5.0 installed

  2. Create a Python virtual environment using python.org Python 3.12 or 3.13

  3. Install boto3, certifi, and pytest

  4. Set SSL_CERT_FILE to point to certifi's cacert.pem bundle

  5. Run pytest from terminal — works as expected

  6. Run debugger in VS Code (using the Python extension) — SSL error occurs


Environment Details
Component | Version -- | -- macOS | 15.5 (M4 MacBook Air) Python | 3.12 and 3.13 (installed from python.org) VS Code | [Insert your VS Code version, from About menu] VS Code Python Extension | Tested with 2025.8.0 and 2025.6.1 debugpy | VS Code bundled version (exact version unknown) Homebrew OpenSSL | 3.5.0
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's ssl context before the SSL_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.


Thank you for your time and assistance.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.