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

Unable to install extensions with code --install-extension in bash. #147670

Closed
cainmagi opened this issue Apr 19, 2022 · 4 comments
Closed

Unable to install extensions with code --install-extension in bash. #147670

cainmagi opened this issue Apr 19, 2022 · 4 comments
Assignees

Comments

@cainmagi
Copy link

cainmagi commented Apr 19, 2022

  • Does this issue occur when all extensions are disabled?: No
    • This issue is exactly related to the installation of extensions. Certainly, we may install an extension when no extensions are installed.
  • Environment
    • VS Code Version: 1.66.2
    • OS Version: Ubuntu 20.04 (focal)
      • The same issue can be reproduced with ubuntu:bionic (18.04) and ubuntu:xenial (16.04). I have not tested it with ubuntu:impish or ubuntu:jammy.

Bug description 📑

When writing Dockerfiles, I may need to install code extensions by bash commands like this:

code --install-extension hookyqr.beautify --extensions-dir "/root/.vscode/extensions" --user-data-dir "/root/.vscode/settings"

where hookyqr.beautify can be the ID of any extension.

Until 4/17/2022, this command can work well. However, since 4/18/2022, the command may cause the following issues:

  • Installing an extenstion take a lot of time, i.e. longer than expect.
  • For any random extension, the installation may meet a failure with Server returned 503. However, if run the same command again, the extension may be successfully installed. A similar problem is mentioned in the issue Server returned 503 error. #57867.
  • For any random extension, the installation may meet a failure with Corrupt ZIP: end of central directory record signature not found. However, if run the same command again, the extension may be successfully installed. A similar problem is mentioned in the issue Corrupted ZIP, no re-download occurs #117169.

Bug report 📜

Currently, when installing the extensions, we may meet such bugs:

Installing extensions...
Installing extension 'hookyqr.beautify'...
(node:374) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `code --trace-deprecation ...` to show where the warning was created)
Extension 'hookyqr.beautify' v1.5.0 was successfully installed.
Installing extensions...
Installing extension 'esbenp.prettier-vscode'...
(node:392) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `code --trace-deprecation ...` to show where the warning was created)
Extension 'esbenp.prettier-vscode' v9.5.0 was successfully installed.
Installing extensions...
Server returned 503
Installing extensions...
Installing extension 'hookyqr.beautify'...
(node:374) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `code --trace-deprecation ...` to show where the warning was created)
Extension 'hookyqr.beautify' v1.5.0 was successfully installed.
Installing extensions...
Installing extension 'esbenp.prettier-vscode'...
Corrupt ZIP: end of central directory record signature not found
Failed Installing Extensions: esbenp.prettier-vscode

Both of the two bugs happen randomly. It means that if we use the same command to install an extension, these bugs may happen or not happen. This problem is very annoying, because when we want to install a lot of extensions, it seems to have an inevitable failure with a non-specific extension.

My suspicion 🤔

I have tried to download the extension file .vsix from the market website. For example,
https://marketplace.visualstudio.com/search?term=hookyqr.beautify&target=VSCode&category=All%20categories&sortBy=Relevance

I can find that the market website is not very stable now. But I can still download the extension if I refresh the page for several times.

After that, I can install the extension like this:

code --install-extension ./HookyQR.beautify-1.5.0.vsix --extensions-dir "/root/.vscode/extensions" --user-data-dir "/root/.vscode/settings"

This time, I can find the following phenomena:

  • It seems that there would be no Server 503 Error if the downloaded package is not an extension pack.
  • However, it is still possible for meeting a Corrput ZIP error, although the possibility is significantly reduced compared to use the online installation method. If I repeat the same command after a failure, it may be successfully installed.
  • The installation for the package may still stuck for a long time, although after a long wait, the package can be installed. The long-time-stuck happens randomly. It means that if I repeat the same command for installing the same downloaded extension, it may be installed instantly or take a long time.

So I guess that both code 1.66.2 and the market website have abnormal behaviors, please help me verify the problem. No proxy is used with my device. It can get access to any website without any problem.

How to reproduce 🔧

Actually, I have written an example Dockerfile for reproducing this bug:

https://gist.github.com/cainmagi/fdf835fcc03b68749f4b0f473dae157a#file-install-vscode-readme-md

Use the following command to build the testing image:

git clone https://gist.github.com/cainmagi/fdf835fcc03b68749f4b0f473dae157a dockertest-vscode
docker build -t vscode:test --build-arg BASE_IMAGE=ubuntu:focal dockertest-vscode

If the users like, they could replace the base image with other Ubuntu releases, like ubuntu:bionic.

It should fail when installing the extensions at Step 11/14 now.

@eprouty
Copy link

eprouty commented Apr 19, 2022

I am unable to install most extensions at this time as well. Just turned on settings sync on a new machine and almost all extensions report:

[2022-04-19 10:12:14.723] [renderer1] [error] ["Invalid: Corrupt ZIP: end of central directory record signature not found","    at D.downloadInstallableExtension (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:76:222768)","    at async D.doRun (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:76:221147)"]
[2022-04-19 10:12:14.742] [renderer1] [error] Corrupt ZIP: end of central directory record signature not found: Invalid: Corrupt ZIP: end of central directory record signature not found

When downloading a .vsix from the marketplace I receive a similar error, I attempted that with Remote - SSH.

Repeatedly attempting to install the same extension will eventually succeed though, seems the marketplace is having serious issues.

@emillma
Copy link

emillma commented Apr 19, 2022

I'm having the same issues. I reinstalled windows 11 and tried with a clean install of vscode but still got the same results.

@cainmagi
Copy link
Author

LMAO, yesterday atom also starts to have a server 500 error when installing plugins. I am wondering whether there is a large hacker team who is attempting to attack all popular code editors...

atom/apm#946 (comment)

@cainmagi
Copy link
Author

Have confirmed that my script can successfully get finished now.

git clone https://gist.github.com/cainmagi/fdf835fcc03b68749f4b0f473dae157a dockertest-vscode
docker build -t vscode:test --build-arg BASE_IMAGE=ubuntu:focal dockertest-vscode

Since I have not modified the script. I think Microsoft has fixed the Server issue. It should be caused by the temporarily low performance of the server.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants