microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.86k stars 29.14k forks source link

Cannot fetch GitHub repositories (proxy issue?) #205545

Closed saw-lau closed 3 months ago

saw-lau commented 8 months ago

Type: Bug

  1. Select 'Clone Repository'
  2. Select 'Clone from GitHub'

'Error: fetch failed' is displayed under the text box to input the repository name, and the following is sent to the Window Output:

2024-02-19 14:26:56.511 [error] [Extension Host] HttpError: fetch failed
    at c:\Users\passma01\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\github\dist\extension.js:2:184490
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async a.$B.d (c:\Users\passma01\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\github\dist\extension.js:2:321021)
    at async Promise.all (index 1)
    at async a.$B.getRemoteSources (c:\Users\passma01\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\github\dist\extension.js:2:320865)
    at async a.k (c:\Users\passma01\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git-base\dist\extension.js:1:3563)

I'm running on a corporate laptop with a proxy server and have my HTTP_PROXY and HTTPS_PROXY environment variables set. This seems to work fine for actual Git commands (i.e. I can push and pull to GitHub), but the initial fetching of the available repositories fails. If I enter the repo details manually in the text box, it clones successfully.

Everything works fine on my Linux laptop with no proxy.

VS Code version: Code 1.86.2 (903b1e9d8990623e3d7da1df3d33db3e42d80eda, 2024-02-13T19:40:56.878Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info |Item|Value| |---|---| |CPUs|13th Gen Intel(R) Core(TM) i9-13900H (20 x 2995)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.66GB (22.74GB free)| |Process Argv|--crash-reporter-id 968ece40-3fec-4a0c-8282-6fed768a4a87| |Screen Reader|no| |VM|0%|
Extensions (6) Extension|Author (truncated)|Version ---|---|--- vscode-pull-request-github|Git|0.80.1 vscode-azurearcenabledmachines|ms-|0.0.1 vscode-azureresourcegroups|ms-|0.8.4 remote-ssh|ms-|0.108.0 remote-ssh-edit|ms-|0.86.0 remote-explorer|ms-|0.4.1
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 fegfb526:30961430 7j2b6412:30967274 bg6jg535:30958357 ```
Ololade131 commented 6 months ago

I have the exact same error! Please help

chrmarti commented 6 months ago

Could you install the Network Proxy Test extension (https://marketplace.visualstudio.com/items?itemName=chrmarti.network-proxy-test) and check the output of F1 > Network Proxy Test: Test Connection in VS Code?

If you cannot install the extension through the Extensions viewlet in VS Code, you can use the Download Extension link on the above linked page and then install the downloaded VSIX with F1 > Extensions: Install VSIX....

lunndal commented 6 months ago

Could you install the Network Proxy Test extension (https://marketplace.visualstudio.com/items?itemName=chrmarti.network-proxy-test) and check the output of F1 > Network Proxy Test: Test Connection in VS Code?

@chrmarti I am seeing the same issue. Here is the output from the extension:

VS Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39)
Network Proxy Test 0.0.11
win32 10.0.22631 x64

Settings:
- http.proxy: http://xxx.xxx.xxx.x37:8080
  - globalValue: http://xxx.xxx.xxx.x37:8080
- http.proxyAuthorization: null
- http.proxyStrictSSL: false
  - globalValue: false
- http.proxySupport: override
- http.systemCertificates: true

Environment variables:
no_proxy=local.git.server

Sending GET request to https://github.com...
vscode-proxy-agent: PROXY xxx.xxx.xxx.x37:8080
Received response:
- Status: 200 OK
Certificate chain:
- Subject: github.com
  Subject alt: DNS:github.com, DNS:www.github.com
  Validity: Mar  7 00:00:00 2024 GMT - Mar  7 23:59:59 2025 GMT
  Fingerprint: E7:03:5B:CC:1C:18:77:1F:79:2F:90:86:6B:6C:1D:F8:DF:AA:BD:C0
- Subject: Sectigo ECC Domain Validation Secure Server CA (Sectigo Limited)
  Validity: Nov  2 00:00:00 2018 GMT - Dec 31 23:59:59 2030 GMT
  Fingerprint: E8:49:90:CB:9B:F8:E3:AB:0B:CA:E8:A6:49:CB:30:FE:4D:C4:D7:67
- Subject: USERTrust ECC Certification Authority (The USERTRUST Network)
  Validity: Mar 12 00:00:00 2019 GMT - Dec 31 23:59:59 2028 GMT
  Fingerprint: CA:77:88:C3:2D:A1:E4:B7:86:3A:4F:B5:7D:00:B5:5D:DA:CB:C7:F9
- Subject: AAA Certificate Services (Comodo CA Limited)
  Validity: Jan  1 00:00:00 2004 GMT - Dec 31 23:59:59 2028 GMT
  Fingerprint: D1:EB:23:A4:6D:17:D6:8F:D9:25:64:C2:F1:F1:60:17:64:D8:E3:49
  Self-signed
Local root certificates:
- Subject: C=GB ST=Greater Manchester L=Salford O=Comodo CA Limited CN=AAA Certificate Services (built-in and OS)
  Validity: Jan  1 00:00:00 2004 GMT - Dec 31 23:59:59 2028 GMT
  Fingerprint: xx:xx:xx:xx:xx:etc
  Issuer: C=GB ST=Greater Manchester L=Salford O=Comodo CA Limited CN=AAA Certificate Services
chrmarti commented 6 months ago

The GitHub extension uses the @octokit packages to access GitHub and these use node-fetch for HTTPS requests.

lunndal commented 6 months ago

The GitHub extension uses the @octokit packages to access GitHub and these use node-fetch for HTTPS requests.

@chrmarti, is this to say that you think the underlying issue should be raised with the octokit team? If not do you have any other suggestions on how to go about troubleshooting this?

Thanks! :)

vscodenpa commented 3 months ago

Hey @chrmarti, this issue might need further attention.

@saw-lau, you can help us out by closing this issue if the problem no longer exists, or adding more information.

chrmarti commented 3 months ago

I think node-fetch should also get the proxy and certificate support VS Code adds like https does. Not sure why this doesn't work in this case.

vs-code-engineering[bot] commented 3 months ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!