code-server icon indicating copy to clipboard operation
code-server copied to clipboard

Extensions installation / update broken @ 3.10.0

Open sobakaio opened this issue 5 years ago • 11 comments

OS/Web Information

  • Web Browser: Google Chrome 90.0.4430.93 (Official Build) (x86_64)
  • Local OS: macOS Big Sur 11.3.1
  • Remote OS: Ubuntu 20.04.2 LTS
  • Remote Architecture: x86_64
  • code-server --version: 3.10.0 6610bff3216c48fdd0884191338b1092765dbb5a

Steps to Reproduce

  1. Start installing (updating) extension from Marketplace
  2. or start installing (updating) extension from CLI

Expected

Installed extension

Actual

If extension install / update started from GUI / CLI using Marketplace or VSIX file the process stalls. Button says 'Installing / Updating' and nothing more. While installing in CLI it stalls on "Installing extensions..."

Logs

1. The most recent files from ~/.local/share/code-server/coder-logs.

empty logs

2. The browser console.

console

3. The browser network tab.

none

4. The most recent files from ~/.local/share/code-server/logs

logs.zip

Screenshot

gui

cli

Notes

This issue can be reproduced in VS Code: No

sobakaio avatar May 11 '21 15:05 sobakaio

Hmm...I'm having trouble reproducing on macOS + Chrome. Here's what I'm doing:

  1. code-server --auth none
  2. Open in browser
  3. Go to Extensions panel
  4. Search extension
  5. Click "Install on Remote"

I also tried installing via the CLI and it worked.

➜  code-server git:(main) SERVICE_URL=https://open-vsx.org/vscode/gallery ITEM_URL=https://open-vsx.org/vscode/item code-server --install-extension esbenp.prettier-vscode
Installing extensions...
Installing extension 'esbenp.prettier-vscode' v6.3.2...
Extension 'esbenp.prettier-vscode' v6.3.2 was successfully installed.

image

We may need to look into this a bit further.

jsjoeio avatar May 11 '21 18:05 jsjoeio

Hey there, I couldn't reproduce it either - it could be possible that one of your extensions is in a corrupted state. Can you uninstall TabNine and try again, or move ~/.local/share/code-server to another location and try with a fresh state?

oxy avatar May 12 '21 09:05 oxy

Unfortunately, switching to new blank configuration didn't help. Reinstalling v.3.10.0 didn't help either.

I'm using systemd to launch code-server as root (don't ask) like that:

/lib/systemd/system/code-server.service

[Unit]
Description=code-server
After=network.target

[Service]
Environment=SERVICE_URL=https://marketplace.visualstudio.com/_apis/public/gallery
Environment=ITEM_URL=https://marketplace.visualstudio.com/items
Type=simple
ExecStart=/usr/bin/code-server --config /etc/code-server/config.yaml
Restart=always

[Install]
WantedBy=multi-user.target

/etc/code-server/config.yaml

bind-addr: 0.0.0.0:444
auth: password
password: **********
cert: /etc/letsencrypt/live/domain.com/cert.pem
cert-key: /etc/letsencrypt/live/domain.com/privkey.pem

I've already tried to change

Environment=SERVICE_URL=https://marketplace.visualstudio.com/_apis/public/gallery
Environment=ITEM_URL=https://marketplace.visualstudio.com/items

to open-vsx.org with no success: I can list all extensions but cant install or update any.

I've been using code-server like that for many releases with no problem. Please advice.

sobakaio avatar May 12 '21 09:05 sobakaio

Hmm...I'm not sure what could have changed. Do you mind recording a video/screencast running this locally and sharing with us?

SERVICE_URL=https://open-vsx.org/vscode/gallery ITEM_URL=https://open-vsx.org/vscode/item code-server --install-extension esbenp.prettier-vscode

jsjoeio avatar May 12 '21 17:05 jsjoeio

Yes, here it is.

I totally removed code-server package and deleted ./local/share/code-server But no success, install process stalls.

code-server-ext-fail

sobakaio avatar May 13 '21 09:05 sobakaio

That's super helpful! Thank you. It looks like you're running those as a separate lines so the variables won't be set when you install the extension. Can you run SERVICE_URL=https://open-vsx.org/vscode/gallery ITEM_URL=https://open-vsx.org/vscode/item code-server --install-extension esbenp.prettier-vscode --log trace as one line and post a video + logs of that? --log trace might show us something useful.

I spoke to @oxy who said it could be related to running as root as well.

jsjoeio avatar May 13 '21 17:05 jsjoeio

You can also test the API with curl by running

curl 'https://open-vsx.org/vscode/gallery/extensionquery' -H "Content-Type: application/json" --data-raw '{"filters":[{"criteria":[{"filterType":4,"value":"does \
not exist"}]}]}'

which should get you:

{"results":[{"extensions":[],"resultMetadata":[{"metadataType":"ResultCount","metadataItems":[{"name":"TotalCount","count":0}]}]}]}

jsjoeio avatar May 13 '21 17:05 jsjoeio

Same thing.

code-server-trace

cli.log

curl 'https://open-vsx.org/vscode/gallery/extensionquery' -H "Content-Type: application/json" --data-raw '{"filters":[{"criteria":[{"filterType":4,"value":"does not exist"}]}]}'

fetches

{"results":[{"extensions":[],"resultMetadata":[{"metadataType":"ResultCount","metadataItems":[{"name":"TotalCount","count":0}]}]}]}

Should I try run code-server as regular user (not root) next?

sobakaio avatar May 13 '21 17:05 sobakaio

Ah, bummer. I see this in the logs Extension VSIX downloads cache dir does not exist but not sure if that matters 🤔

Yeah, try running as a regular user and seeing what happens.

jsjoeio avatar May 13 '21 19:05 jsjoeio

It looks like the /bin/bash node -p spawn never exits. Does something like this work?

$ /bin/bash -ilc 'echo hello'
hello

If that works perhaps try the full command:

$ /bin/bash -ilc "/usr/lib/code-server/lib/node -p '\"<marker>\" + JSON.stringify(process.env) + \"</marker>\"'"
<marker>{<env should show here>}</marker>

If it doesn't work perhaps there's something blocking in the .bashrc or .profile?

code-asher avatar May 13 '21 21:05 code-asher

/bin/bash -ilc 'echo hello'

Thank you so much! Your snippet solved my problem. I had an admin text menu bash script autoloaded in .profile After removed now it works correctly. Thank you, you're breathtaking!

sobakaio avatar May 18 '21 09:05 sobakaio