question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

OS/Web Information

  • Web Browser: Chromium (brave), although I also tested with Firefox and Edge and got the same result.
  • Local OS: Windows 11
  • Remote OS: Ubuntu
  • Remote Architecture: x86-64
  • code-server --version: 3.12.0

Steps to Reproduce

  1. Ran code-server (i also tried using --proxy-domain <my domain> to see if I got any different results.) I used nginx to reverse proxy to my domain, I also use Cloudflare.
  2. When I open the domain on my browser, I get
The workbench failed to connect to the server (Error: WebSocket close with status code 1006)

Expected

The server would work normally.

Actual

See error above.

Logs

Logs look normal for the remote server, however browser gives error:

[vscode] failed to initialize VS Code vscode.browserified.js:726:13
    [4]< <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:726
    o <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
    r <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
    <anonymous> <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1

(I replaced my domain with <domain> for privacy reasons.)

Error: [vscode] Could not set body background to theme background color. Could not find colorThemeData in localStorage.
    setBodyBackgroundToThemeBackgroundColor <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:668
    main <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:719
    [4]< <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:723
    o <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
    r <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
    <anonymous> <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
vscode.browserified.js:727:13
    [4]< <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:727
    o <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
    r <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1
    <anonymous> <domain>/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/out/browser/pages/vscode.browserified.js:1

Screenshot

image

Notes

This issue can be reproduced in VS Code: No

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

27reactions
woshilaibacommented, Nov 4, 2021

i got this too. i ran it in docker. i found there must be lines below in the nginx.conf to make it work location / { proxy_pass http://codeserver.xxx.xxx:8443/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection upgrade; proxy_set_header Accept-Encoding gzip; } this is from https://github.com/cdr/code-server/blob/main/docs/guide.md#using-lets-encrypt-with-nginx

10reactions
AuthorShincommented, Mar 25, 2022

When adding the domain or subdomain for code-server on Nginx Proxy Manager make sure to check the Websockets support to solve the problem. Screenshot-2022-03-25-175109

Read more comments on GitHub >

github_iconTop Results From Across the Web

The workbench failed to connect to the server (Error ... - GitHub
The workbench failed to connect to the server (Error: WebSocket close with status code 1006) #4443. Closed.
Read more >
Vscode cannot connect to remote Linux (_WebSocket close ...
This worked for me and when I went back into the Ubuntu shell and ran code . it updated the VS Code Server....
Read more >
Websocket error 1006 with VSCode - Traefik v2
Hi all,. I'm trying to set up VSCode behind my traefikv2 container. Unfortunately I get a WebSocket 1006 error every time.
Read more >
What Is Meant By Channels Error 1006? - Pusher
When a WebSocket connection is closed without a "close frame", the pusher-js library emits an error with code 1006. Usually this is caused...
Read more >
Error 1006 abnormal close websocket? - Arduino Forum
Error 1006 means there's a low-level issue with websocket itself, or rather the code used to create the websocket. Without posting your code, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found