Language Server behind forward proxy
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
My compnay uses forward proxy with custom SSL cert. Is there a way to trust the company's CA chain for langugage servers?
Language server error: YAML
failed to execute npm info subcommand:
stdout: "{\n \"error\": {\n \"code\": \"SELF_SIGNED_CERT_IN_CHAIN\",\n \"summary\": \"request to https://registry.npmjs.org/yaml-language-server failed, reason: self-signed certificate in certificate chain\",\n \"detail\": \"\"\n }\n}\n"
stderr: "npm ERR! code SELF_SIGNED_CERT_IN_CHAIN\nnpm ERR! errno SELF_SIGNED_CERT_IN_CHAIN\nnpm ERR! request to https://registry.npmjs.org/yaml-language-server failed, reason: self-signed certificate in certificate chain\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/cache/_logs/2024-03-01T05_49_46_200Z-debug-0.log\n"
Language server error: JSON
failed to execute npm info subcommand:
stdout: "{\n \"error\": {\n \"code\": \"SELF_SIGNED_CERT_IN_CHAIN\",\n \"summary\": \"request to https://registry.npmjs.org/vscode-json-languageserver failed, reason: self-signed certificate in certificate chain\",\n \"detail\": \"\"\n }\n}\n"
stderr: "npm ERR! code SELF_SIGNED_CERT_IN_CHAIN\nnpm ERR! errno SELF_SIGNED_CERT_IN_CHAIN\nnpm ERR! request to https://registry.npmjs.org/vscode-json-languageserver failed, reason: self-signed certificate in certificate chain\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/cache/_logs/2024-03-01T05_54_08_519Z-debug-0.log\n"
0 verbose cli /Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/bin/node /Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/bin/npm
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/lib/node_modules/npm/npmrc Completed in 0ms
6 timing config:load:builtin Completed in 0ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:/Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/blank_user_npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/blank_global_npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 1ms
16 timing config:load Completed in 4ms
17 timing npm:load:configload Completed in 4ms
18 timing npm:load:mkdirpcache Completed in 0ms
19 timing npm:load:mkdirplogs Completed in 0ms
20 verbose title npm info vscode-json-languageserver
21 verbose argv "info" "--cache" "/Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/cache" "--userconfig" "/Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/blank_user_npmrc" "--globalconfig" "/Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/blank_global_npmrc" "vscode-json-languageserver" "--json" "--fetch-retry-mintimeout" "2000" "--fetch-retry-maxtimeout" "5000" "--fetch-timeout" "5000"
22 timing npm:load:setTitle Completed in 6ms
23 timing config:load:flatten Completed in 1ms
24 timing npm:load:display Completed in 2ms
25 verbose logfile logs-max:10 dir:/Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/cache/_logs/2024-03-01T05_54_08_519Z-
26 verbose logfile /Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/cache/_logs/2024-03-01T05_54_08_519Z-debug-0.log
27 timing npm:load:logFile Completed in 2ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 15ms
31 silly logfile start cleaning logs, removing 2 files
32 silly logfile done cleaning log files
33 timing command:info Completed in 7129ms
34 verbose type system
35 verbose stack FetchError: request to https://registry.npmjs.org/vscode-json-languageserver failed, reason: self-signed certificate in certificate chain
35 verbose stack at ClientRequest.<anonymous> (/Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:130:14)
35 verbose stack at ClientRequest.emit (node:events:513:28)
35 verbose stack at TLSSocket.socketErrorListener (node:_http_client:502:9)
35 verbose stack at TLSSocket.emit (node:events:525:35)
35 verbose stack at emitErrorNT (node:internal/streams/destroy:151:8)
35 verbose stack at emitErrorCloseNT (node:internal/streams/destroy:116:3)
35 verbose stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
36 verbose cwd /
37 verbose Darwin 23.3.0
38 verbose node v18.15.0
39 verbose npm v9.5.0
40 error code SELF_SIGNED_CERT_IN_CHAIN
41 error errno SELF_SIGNED_CERT_IN_CHAIN
42 error request to https://registry.npmjs.org/vscode-json-languageserver failed, reason: self-signed certificate in certificate chain
43 verbose exit 1
44 timing npm Completed in 7161ms
45 verbose code 1
46 error A complete log of this run can be found in:
46 error /Users/chan/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/cache/_logs/2024-03-01T05_54_08_519Z-debug-0.log
Environment
Zed: v0.124.8 (Zed)
OS: macOS 14.3.1
Memory: 64 GiB
Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.
If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.
No response
Check out #5032.
Alternatively #5135 #4978 -- don't download language servers in the first place, let people use their existing ones.
I hope this will be the way going forward as language support is moved out into extensions more.
I still see this issue on Zed Preview 0.137.0 with the patch from #11852.
In this case when I load a python project and it attempts to install the pyright LSP:
2024-05-23T10:17:56+12:00 [ERROR] failed to start language server "pyright": failed to execute npm info subcommand:
stdout: "{\n \"error\": {\n \"code\": \"SELF_SIGNED_CERT_IN_CHAIN\",\n \"summary\": \"request to https://registry.npmjs.org/pyright failed, reason: self-signed certificate in certificate chain\",\n \"detail\": \"\"\n }\n}\n"
stderr: "npm ERR! code SELF_SIGNED_CERT_IN_CHAIN\nnpm ERR! errno SELF_SIGNED_CERT_IN_CHAIN\nnpm ERR! request to https://registry.npmjs.org/pyright failed, reason: self-signed certificate in certificate chain\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /Users/<>/Library/Application Support/Zed/node/node-v18.15.0-darwin-x64/cache/_logs/2024-05-22T22_17_49_373Z-debug-0.log\n"
This is on a device with a (transparent) forward proxy and custom SSL certificates.
Setting cafile to custom certificates bundle is what I use to get npm package installs to work (Setting NODE_EXTRA_CA_CERTS also works.) I.E.
$ cat ~/.npmrc
cafile=/etc/ssl/cert.pem
...
+1.
NODE_EXTRA_CA_CERTS environment variable should be forwarded to npm.