NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.22k stars 13.5k forks source link

VSCode (installed from nixpkgs.vscode or nixpkgs.vscode-with-extensions) cannot access the extensions store #125222

Open udif opened 3 years ago

udif commented 3 years ago

Describe the bug Any VSCode instance installed under Nix cannot access the extensions marketplace. This happens regardless of:

To Reproduce Install with nix-pkgs -iA nixpkgs.vscode or nix-pkgs -iA nixpkgs.vscode-with-extensions

run vscode: code click the extensions store icon on the left, and you'll get a message: We cannot connect to the Extensions Marketplace at this time, please try again later.

Expected behavior A list of extenions from the extension store should appear

Screenshots If applicable, add screenshots to help explain your problem.

Additional context I ran code --verbose twice, once with a working vscode 1.48 outside Nix, and one with 1.56.2 from within Nix.

For the working 1.48 I get:

[11827:0601/155425.999518:INFO:CONSOLE(1679)] "%cTRACE color: #888 RequestService#request https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery", source: file:///usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js (1679)
[main 2021-06-01T12:54:26.015Z] menubarService#updateMenubar 1
[main 2021-06-01T12:54:40.548Z] update#checkForUpdates, state =  idle
[main 2021-06-01T12:54:40.548Z] update#setState checking for updates
[main 2021-06-01T12:54:40.548Z] RequestService#request https://update.code.visualstudio.com/api/update/linux-x64/stable/a0479759d6e9ea56afa657e454193f72aef85bd0
[main 2021-06-01T12:54:40.913Z] update#setState available for download

For the non-working Nix version:

[9773:0601/155143.597046:INFO:CONSOLE(627)] "%cTRACE color: #888 RequestService#request https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery", source: file:///nix/store/lxp9wx82zmdvmsrk204vv1jz329k4wni-vscode-1.56.2/lib/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js (627)
[9815:0601/155143.619358:ERROR:ssl_client_socket_impl.cc(924)] handshake failed; returned -1, SSL error code 1, net_error -202
[9773:0601/155143.621482:INFO:CONSOLE(2701)] "Error querying extensions gallery XHR failed", source: file:///nix/store/lxp9wx82zmdvmsrk204vv1jz329k4wni-vscode-1.56.2/lib/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js (2701)
[main 2021-06-01T12:51:47.792Z] menubarService#updateMenubar 1
[main 2021-06-01T12:52:01.871Z] update#checkForUpdates, state =  idle
[main 2021-06-01T12:52:01.871Z] update#setState checking for updates
[main 2021-06-01T12:52:01.871Z] RequestService#request https://update.code.visualstudio.com/api/update/linux-x64/stable/054a9295330880ed74ceaedda236253b4f39a335
[main 2021-06-01T12:52:01.872Z] resolveShellEnv(): skipped (VSCODE_CLI is set)
[9815:0601/155202.015482:ERROR:ssl_client_socket_impl.cc(924)] handshake failed; returned -1, SSL error code 1, net_error -202
[main 2021-06-01T12:52:02.016Z] Error: net::ERR_CERT_AUTHORITY_INVALID
    at SimpleURLLoaderWrapper.<anonymous> (electron/js2c/browser_init.js:109:7029)
    at SimpleURLLoaderWrapper.emit (events.js:315:20)

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 3.10.0-1062.el7.x86_64, Red Hat Enterprise Linux Server, 7.7 (Maipo)`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.3.11`
 - channels(udif): `"nixpkgs-21.11pre292293.84aa23742f6"`
 - nixpkgs: `/home/udif/.nix-defexpr/channels/nixpkgs`

This is a RHEL-7 based system where I have no root or sudo, but the system maitainer created a /nix dir for me with the correct permission so I could manage my own packages using Nix.

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
berbiche commented 3 years ago

[9815:0601/155202.015482:ERROR:ssl_client_socket_impl.cc(924)] handshake failed; returned -1, SSL error code 1, net_error -202 [main 2021-06-01T12:52:02.016Z] Error: net::ERR_CERT_AUTHORITY_INVALID

Looks like the package does not have access to the certificates database. I don't use a non-nixos system, but I think you could just add cacert to your list of packages to resolve the issue.

udif commented 3 years ago

Thanks for your suggestion!

I've installed cacert :

[udif@udif-rh7 ~]$ nix-env -qa --installed "*" | grep cacert
nss-cacert-3.63

Unfortunately, this doesn't seem to have any effect. Running code --verbose still yields the same error:

[2442:0602/101821.281355:INFO:CONSOLE(627)] "%cTRACE color: #888 RequestService#request https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery", source: file:///nix/store/lxp9wx82zmdvmsrk204vv1jz329k4wni-vscode-1.56.2/lib/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js (627)
[2516:0602/101821.302839:ERROR:ssl_client_socket_impl.cc(924)] handshake failed; returned -1, SSL error code 1, net_error -202
[2442:0602/101821.304280:INFO:CONSOLE(2701)] "Error querying extensions gallery XHR failed", source: file:///nix/store/lxp9wx82zmdvmsrk204vv1jz329k4wni-vscode-1.56.2/lib/vscode/resources/app/out/vs/workbench/workbench.desktop.main.js (2701)
[main 2021-06-02T07:18:40.100Z] update#checkForUpdates, state =  idle
[main 2021-06-02T07:18:40.101Z] update#setState checking for updates
[main 2021-06-02T07:18:40.101Z] RequestService#request https://update.code.visualstudio.com/api/update/linux-x64/stable/054a9295330880ed74ceaedda236253b4f39a335
[main 2021-06-02T07:18:40.101Z] resolveShellEnv(): skipped (VSCODE_CLI is set)
[2516:0602/101840.255689:ERROR:ssl_client_socket_impl.cc(924)] handshake failed; returned -1, SSL error code 1, net_error -202
[main 2021-06-02T07:18:40.256Z] Error: net::ERR_CERT_AUTHORITY_INVALID
    at SimpleURLLoaderWrapper.<anonymous> (electron/js2c/browser_init.js:109:7029)

I even tried installing the google-chrome package assuming that if there are any missing certs it will complain as well, or bring in any missing pakcages. Unfortunately, google-chrome works fine after installing it, but vscode still doesn't :-(

I then googleed for ssl_client_socket_impl.cc(924) from the error message and came up with this: I noticed that the suggestion to use the --ignore-certificate-errors flag, and surprisingly, it worked! I still don't know why there are certificate errors, but at least I now have a working system.

SuperSamus commented 2 years ago

Trying VSCodium right now, the extensions from the store are perfectly visible.