Skip to content

[Bug]: The workbench failed to connect to the server #6014

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

Closed
4 tasks done
JonSmall opened this issue Feb 11, 2023 · 7 comments
Closed
4 tasks done

[Bug]: The workbench failed to connect to the server #6014

JonSmall opened this issue Feb 11, 2023 · 7 comments
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer

Comments

@JonSmall
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Chrome
  • Local OS: Windows
  • Remote OS: Docker
  • Remote Architecture: Docker Image
  • code-server --version: 4.9.1

Steps to Reproduce

  1. docker run -d -it --name code-server -p 8080:8080
    -v "/home/docker/code-server/config:/home/coder/.config"
    -v "/home/docker/code-server:/home/coder/project"
    -u "$(id -u):$(id -g)"
    -e "DOCKER_USER=$USER"
    codercom/code-server:4.9.1

  2. open chrome http://${ip}:8080

  3. find the config.yaml, and enter the password

  4. it shows
    The workbench failed to connect to the server (Error: WebSocket close with status code 1006)
    and again and agin reload, i can`t use it

Expected

Not show
The workbench failed to connect to the server (Error: WebSocket close with status code 1006)
And use the IDE

Actual

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

Logs

File not found: /usr/lib/code-server/lib/vscode/extensions/git-base/dist/browser/extension.js
File not found: /usr/lib/code-server/lib/vscode/extensions/emmet/dist/browser/emmetBrowserMain.js
File not found: /usr/lib/code-server/lib/vscode/extensions/merge-conflict/dist/browser/mergeConflictMain.js

Screenshot/Video

888888

Does this issue happen in VS Code or GitHub Codespaces?

  • I cannot reproduce this in VS Code.
  • I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

No response

@JonSmall JonSmall added bug Something isn't working triage This issue needs to be triaged by a maintainer labels Feb 11, 2023
@code-asher
Copy link
Member

code-asher commented Feb 13, 2023 via email

@ManuXD32
Copy link

Does the IP you are connecting to go directly to the Docker container or is there some kind of proxy in between? Usually 1006 means something is dropping the web socket. Is this Docker Desktop on Windows or over WSL?

I am having the same error, mine is through an apache reverse proxy. I have tried the solutions of other threads, but they just don't work.
Any idea?

@code-asher
Copy link
Member

code-asher commented Mar 30, 2023 via email

@ManuXD32
Copy link

ManuXD32 commented Apr 5, 2023

Do you see any warnings or errors in code-server's logs? If you are using 4.10.1 or later also make sure that the host header matches the origin header that the browser is sending otherwise the socket will be blocked for security reasons.

It turned out to be a missconfiguration under the .conf file. GPT4 solved It heh. Thank you so much, anyway.

@freaker2112
Copy link

Do you see any warnings or errors in code-server's logs? If you are using 4.10.1 or later also make sure that the host header matches the origin header that the browser is sending otherwise the socket will be blocked for security reasons.

It turned out to be a missconfiguration under the .conf file. GPT4 solved It heh. Thank you so much, anyway.

what fixed it? I'm having this same issue

@ManuXD32
Copy link

ManuXD32 commented Apr 20, 2023

Do you see any warnings or errors in code-server's logs? If you are using 4.10.1 or later also make sure that the host header matches the origin header that the browser is sending otherwise the socket will be blocked for security reasons.

It turned out to be a missconfiguration under the .conf file. GPT4 solved It heh. Thank you so much, anyway.

what fixed it? I'm having this same issue

Try changing your .conf file to look like this: Ps: remember to end the conf file with "</VirtualHost>" for some reason my comment looks weird,

<VirtualHost *:80>
ServerName codeYOUR_DOMAIN
ServerAdmin USER@YOUR_DOMAIN
ProxyPreserveHost On
ProxyRequests Off
AllowEncodedSlashes NoDecode

<Location />
    ProxyPass http://localhost:YOUR_PORT/ nocanon
    ProxyPassReverse http://localhost:YOUR_PORT/
    ProxyPassReverseCookieDomain localhost codeYOUR_DOMAIN
    ProxyPassReverseCookiePath / /
</Location>

RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:YOUR_PORT/$1" [P,L]

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

@code-asher
Copy link
Member

Closing as stale but feel free to comment if you come back to this.

@code-asher code-asher closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer
Projects
None yet
Development

No branches or pull requests

4 participants