visual-studio-codemarketplace

Visual Studio Code "Error while fetching extensions. XHR failed"


This problem started a few weeks ago, when I started using NordVPN on my laptop. When I try to search for an extension and even when trying to download through the marketplace I get this error: enter image description here

EDIT: Just noticed another thing that might indicate to what's causing the issue. When I open VSCode and go to developer tools I get this error messege (before even doing anything):

"(node:19368) [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)"

The only partial solution I found so far was to manually download and install extensions.

I've checked similar question here and in other places online, but I didn't find a way to fix this. So far I've tried:

  1. Flushing my DNS cache and setting it to google's DNS server.
  2. Disabling the VPN on my laptop and restarting VS Code.
  3. Clearing the Extension search results.
  4. Disabling all the extensions currently running.

I'm using a laptop running Windows 10. Any other possible solutions I haven't tried?


Solution

  • In my case, the solution was to remove HTTPS_PROXY (Could be HTTP_PROXY) environment variable set during terminal initialisations.

    Environment variables can be confirmed by env command for most operating systems.

    I removed the line which sets the environment variable for proxy from the bash profile, then restarted the OS.

    Apart from ~/.bashrc for bash or any other sh-compatible shell, the environment variable could be in:

    Credit to this post. https://unix.stackexchange.com/a/249922

    The environment variable HTTP(S)_PROXY may be used by other applications. Therefore, be aware of the side effects of removing it.