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

The workbench failed to connect to the server (Error: WebSocket close with status code 1006)

Open dokastho opened this issue 4 years ago • 6 comments

Fix

added the following lines to my site's .conf in /etc/nginx/sites-available :

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;

✅

OS/Web Information

  • Web Browser: Google chrome
  • Local OS: Windows 10
  • Remote OS: Ubuntu Server 20.04
  • Remote Architecture: amd64
  • code-server --version: 4.0.1

Steps to Reproduce

  1. run install script
  2. start code-server service
  3. open browser to code-server website (nginx reverse proxy)
  4. get error The workbench failed to connect to the server (Error: WebSocket close with status code 1006)
  5. remote service error reads ENOENT no such file or directory, open '/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/code/browser/workbench/workbench.html'

Expected

Code server should open and run on a fresh install. This is a new install of code-server and I think it's attempting to load extensions from the old install that have not been installed yet. I had tried to move the install location under bad stack overflow advice and ever since it's not been working correctly

Actual

Repeatedly reloads page and immediately throws same exception. Again, this is a new install of code-server and I think it's attempting to load extensions from the old install that have not been installed yet. I had tried to move the install location under bad stack overflow advice and ever since it's not been working correctly

Logs Screenshot

Notes

Once again, this is a new install of code-server and I think it's attempting to load extensions from the old install that have not been installed yet. I had tried to move the install location under bad stack overflow advice and ever since it's not been working correctly. Can be reproduced across versions 3.12.0, 3.6.2, 3.9.1 and 4.0.1. Webserver config: Nginx reverse proxy with Oauth2-proxy default config and google oauth 2.0 This issue can be reproduced in VS Code: No

dokastho avatar Jan 19 '22 07:01 dokastho

I have the same problem if I try to update from 3.12.0 to 4.0.1. I tried to clean the folder ~/.local/share/code-server to try a "clean" restart but the problem is still there. To have a running environment I had to downgrade to 3.12.0 with the installer script.

gmiscione avatar Jan 19 '22 14:01 gmiscione

I have the same problem if I try to update from 3.12.0 to 4.0.1. I tried to clean the folder ~/.local/share/code-server to try a "clean" restart but the problem is still there. To have a running environment I had to downgrade to 3.12.0 with the installer script.

in notes: Can be reproduced across versions 3.12.0, 3.6.2, 3.9.1 and 4.0.1 Version 3.12.0 does not fix the bug

dokastho avatar Jan 19 '22 15:01 dokastho

See fix in original post

dokastho avatar Jan 19 '22 19:01 dokastho

See fix in original post

Hi, Sorry to bother you, but I’m absolute noob… I just started to learn coding and decided to set up code-server docker to be able to learn whiles at work remotely (on my free time  ). So I’ve run in to the same issue, I’ve tried to fallow your fix, but the only file in /etc/nginx/sites-available/ is ‘default’. I’ve tried to add the lines from your post and restart code-server docker, but nothing changed. Also tried to create new file ‘.conf’ with same lines from your post with no luck as well. Just to clarify, I’m using nginx proxy and cloudflare. Could you please please please  explain to me what I’m doing wrong? Thank you! and sorry for wasting your time.

Lamerys avatar Feb 23 '22 19:02 Lamerys

@Lamerys feel free to start a new Q and A discussion and we'll see if we can help you!

jsjoeio avatar Feb 23 '22 23:02 jsjoeio

@Lamerys feel free to start a new Q and A discussion and we'll see if we can help you!

Thank you. All sorted, just needed to activate websocket via Nginx panel.

Lamerys avatar Feb 23 '22 23:02 Lamerys