Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extensions in devcontainer.json are not automatically installed #6268

Closed
JackCaster opened this issue Feb 2, 2022 · 3 comments
Closed

extensions in devcontainer.json are not automatically installed #6268

JackCaster opened this issue Feb 2, 2022 · 3 comments
Labels
containers Issue in vscode-remote containers *duplicate Issue identified as a duplicate of another issue(s) proxy Issues regarding network proxies

Comments

@JackCaster
Copy link

JackCaster commented Feb 2, 2022

  • VSCode Version: 1.63.2
  • Local OS Version: Win 10.0.19042 Build 19042
  • Remote OS Version: Debian GNU/Linux 10 (buster)
  • Remote Extension/Connection Type: Docker
  • Logs: https://rentry.co/mbyya

Steps to Reproduce:

I have similar problems to #2987 #986 #5620 but I could not find the solution there. I also tried the vscode insider.

I am on a business computer running Windows 10 (+ Ubuntu WSL). This machine has some custom proxy/certificates in place. Extensions defined in .devcontainer/devcontainer.json are not installed during the container build process---but they can be installed with the GUI later on (as indicated in the last part of the attached log). A part from (silently) not installing the extensions, everything is fine. Before doing anything, I checked if there were some issues with proxy/certificates in the container terminal. I could ping/curl websites and I could apt update && apt upgrade without problems. This suggests that the custom network settings are correctly picked up by the container (perhaps from the WSL?).

Running the server.sh code to install the extension as it appears in the logs (and adding export NODE_TLS_REJECT_UNAUTHORIZED=0 as an attempt to fix the issue)

/root/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/server.sh --log debug --force-disable-user-env --use-host-proxy --disable-telemetry --port 0 --extensions-download-dir /root/.vscode-server/extensionsCache --install-extension eamodio.gitlens --start-server --disable-websocket-compression

but it issues the error unable to get local issuer certificate.

*
* Visual Studio Code Server
*
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license https://aka.ms/vscode-remote/license
*

Extension host agent listening on 39693

[12:04:58] Extension host agent started.
Installing extensions...
(node:13197) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
unable to get local issuer certificate
[12:05:00] Error: Failed Installing Extensions: eamodio.gitlens
    at S.installExtensions (/vscode/vscode-server/bin/linux-x64/899d46d82c4c95423fb7e10e68eba52050e30ba3/out/vs/server/remoteExtensionHostAgent.js:89:42)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

As I said, the container seems to have all the correct network parameters in place, but still I get an error on missing certificates. I also added export NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt (and reinstalled the corporate certificates) but the problem persists.

Would you be able to help?

@github-actions github-actions bot added the containers Issue in vscode-remote containers label Feb 2, 2022
@JackCaster
Copy link
Author

JackCaster commented Feb 2, 2022

Ok, I fixed this issue with a clearer mind. I'll leave a note here for posterity:

Retrieve the (corporate) certificate and save it at .devcontainer/<certificate-name>.crt. Get the proxy info. Then, modify the Dockerfile:

FROM continuumio/miniconda3:4.10.3

ARG EXTRA_CRT=<certificate-name>.crt
COPY $EXTRA_CRT /tmp/

ENV NODE_EXTRA_CA_CERTS=/tmp/$EXTRA_CRT \
    HTTP_PROXY=<proxy-address> \
    HTTPS_PROXY=<proxy-address>

There is no need to install the certificates with update-ca-certificates if you do not need them for other reasons than installing the extensions in the Docker container.

@JackCaster
Copy link
Author

JackCaster commented Mar 10, 2022

The solution does not work any longer. Despite NODE_EXTRA_CA_CERTS being set, the Python extension is not installed when the image is built. In the output for Log (Remote Server) I see:

[2022-03-10 12:58:00.287] [remoteagent] [info] Extension host agent started.
[2022-03-10 12:58:00.811] [remoteagent] [info] [127.0.0.1][bef0a8bc][ManagementConnection] New connection established.
[2022-03-10 12:58:01.594] [remoteagent] [info] [127.0.0.1][b837fe88][ExtensionHostConnection] New connection established.
[2022-03-10 12:58:01.602] [remoteagent] [info] [127.0.0.1][b837fe88][ExtensionHostConnection] <263> Launched Extension Host Process.
[2022-03-10 12:58:01.915] [remoteagent] [error] Error: Failed Installing Extensions: ms-python.python
    at f.installExtensions (/vscode/vscode-server-insiders/bin/linux-x64/92f4bd7894c3b790d37b1eec3c7fb5e5f8618f70-insider/out/vs/server/node/server.main.js:81:42)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

Then, if I install the extension from the GUI, I get in Log (Remote Server)

[2022-03-10 13:00:44.857] [remoteagent] [info] Getting Manifest... ms-python.python
[2022-03-10 13:00:45.414] [remoteagent] [error] Failed to install extension. ms-python.python
[2022-03-10 13:00:45.415] [remoteagent] [error] Error: unable to get local issuer certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1497:34)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket._finishInit (_tls_wrap.js:932:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:706:12)
[2022-03-10 13:00:48.461] [remoteagent] [info] Installing extension: ms-toolsai.jupyter
[2022-03-10 13:00:48.461] [remoteagent] [info] Installing the extension without checking dependencies and pack ms-toolsai.jupyter
[2022-03-10 13:00:49.473] [remoteagent] [info] Extracted extension to /root/.vscode-server-insiders/extensions/.dd5c3cb8-67c2-484c-862d-1969ab82b9bb: ms-toolsai.jupyter
[2022-03-10 13:00:49.485] [remoteagent] [info] Renamed to /root/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2022.2.1030672458
[2022-03-10 13:00:49.487] [remoteagent] [info] Extracting completed. ms-toolsai.jupyter
[2022-03-10 13:00:49.487] [remoteagent] [info] Extension installed successfully: ms-toolsai.jupyter
[2022-03-10 13:00:51.900] [remoteagent] [info] Installing extension: ms-python.vscode-pylance
[2022-03-10 13:00:51.900] [remoteagent] [info] Installing the extension without checking dependencies and pack ms-python.vscode-pylance
[2022-03-10 13:00:54.749] [remoteagent] [info] Extracted extension to /root/.vscode-server-insiders/extensions/.c452d09b-460f-477f-bac7-efec1aa484ba: ms-python.vscode-pylance
[2022-03-10 13:00:54.762] [remoteagent] [info] Renamed to /root/.vscode-server-insiders/extensions/ms-python.vscode-pylance-2022.3.1
[2022-03-10 13:00:54.763] [remoteagent] [info] Extracting completed. ms-python.vscode-pylance
[2022-03-10 13:00:54.764] [remoteagent] [info] Extension installed successfully: ms-python.vscode-pylance
[2022-03-10 13:00:55.474] [remoteagent] [info] Installing extension: ms-toolsai.jupyter-renderers
[2022-03-10 13:00:55.474] [remoteagent] [info] Installing the extension without checking dependencies and pack ms-toolsai.jupyter-renderers
[2022-03-10 13:00:56.122] [remoteagent] [info] Extracted extension to /root/.vscode-server-insiders/extensions/.29909f39-ed69-4ba0-b5b5-c68cd58dab31: ms-toolsai.jupyter-renderers
[2022-03-10 13:00:56.127] [remoteagent] [info] Renamed to /root/.vscode-server-insiders/extensions/ms-toolsai.jupyter-renderers-1.0.6
[2022-03-10 13:00:56.127] [remoteagent] [info] Extracting completed. ms-toolsai.jupyter-renderers
[2022-03-10 13:00:56.128] [remoteagent] [info] Extension installed successfully: ms-toolsai.jupyter-renderers
[2022-03-10 13:00:57.594] [remoteagent] [info] Installing extension: ms-python.python
[2022-03-10 13:00:57.594] [remoteagent] [info] Installing the extension without checking dependencies and pack ms-python.python
[2022-03-10 13:00:59.535] [remoteagent] [info] Extracted extension to /root/.vscode-server-insiders/extensions/.7e3204f5-65e0-45a1-aec8-8c8297c8c15d: ms-python.python
[2022-03-10 13:00:59.548] [remoteagent] [info] Renamed to /root/.vscode-server-insiders/extensions/ms-python.python-2022.2.1924087327
[2022-03-10 13:00:59.550] [remoteagent] [info] Extracting completed. ms-python.python
[2022-03-10 13:00:59.550] [remoteagent] [info] Extension installed successfully: ms-python.python

So, it says there is a problem with the certificate but then the extension is installed anyway.

I am using vscode insider v. 1.66.0

@JackCaster JackCaster reopened this Mar 10, 2022
@chrmarti chrmarti added the proxy Issues regarding network proxies label Mar 22, 2022
@chrmarti
Copy link
Contributor

Tracking as #2393.

@chrmarti chrmarti added the *duplicate Issue identified as a duplicate of another issue(s) label Mar 22, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers *duplicate Issue identified as a duplicate of another issue(s) proxy Issues regarding network proxies
Projects
None yet
Development

No branches or pull requests

2 participants