The workbench failed to connect to the server error websocket close with status code 1006

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-serve...

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 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 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

Содержание

  1. The workbench failed to connect to the server error websocket close with status code 1006
  2. [SOLVED] code server WebSocket close with status code 1006
  3. What is the websocket 1006 error?
  4. Why do I see this error?
  5. How to fix it?
  6. Use the –link parameter to get a temporary https
  7. Option 1 : get the link locally
  8. Option 2 : Use ngrok
  9. Getting the reason why websockets closed with close code 1006
  10. 8 Answers 8
  11. Vscode cannot connect to remote Linux (_WebSocket close with status code 1006)
  12. 9 Answers 9

The workbench failed to connect to the server error websocket close with status code 1006

[SOLVED] code server WebSocket close with status code 1006

At the end of the installation of the code server, you are ready to enjoy your new development workflow, and then, you see this message “WebSocket close with status code 1006”. How to solve it? Check out these answers

Note: If you are confused about what code server is, check this post which explains it.

Check your https connection. Your browser cannot reach your code server instance.

What is the websocket 1006 error?

The websocket 1006 error means that the connection has been closed, locally, by your browser.

If you see a close code 1006, you have a very low level error with WebSocket itself as this error is not really meant for the user. The websocket 1006 error points to a low level issue with your code and implementation.

Why do I see this error?

The main reason is that the connection was closed abnormally (locally) by the browser implementation.

It means that your browser cannot reach your remote code server. The main issue is about your https connection to the server.

How to fix it?

You might not be sure about the process to follow in order to setup code server. I did a tutorial on how to setup code server cloud IDE platform on digitalocean using kubernetes.

If you speak french, the french version is here.

The good news is that, there are two possible solutions :

Use the –link parameter to get a temporary https

Option 1 : get the link locally

Option 2 : Use ngrok

ngrok will tunnel and create an https connection to your server.

Use wss to forward

Here is the code to perform the forwarding and solve the issue

Источник

Getting the reason why websockets closed with close code 1006

I would like to get the reason websockets closed, so I can show the right message to the user.

The code is always 1006 and the reason is always » «. But I want to tell different closing reasons apart.

For example the comand line gives an error reason : «you cannot delete that, because database wont let you». But on Chrome’s console, the reason is still » «.

Any other way to tell different closing reasons apart?

8 Answers 8

Close Code 1006 is a special code that means the connection was closed abnormally (locally) by the browser implementation.

If your browser client reports close code 1006 , then you should be looking at the websocket.onerror(evt) event for details.

However, Chrome will rarely report any close code 1006 reasons to the Javascript side. This is likely due to client security rules in the WebSocket spec to prevent abusing WebSocket. (such as using it to scan for open ports on a destination server, or for generating lots of connections for a denial-of-service attack).

Note that Chrome will often report a close code 1006 if there is an error during the HTTP Upgrade to Websocket (this is the step before a WebSocket is technically «connected»). For reasons such as bad authentication or authorization, or bad protocol use (such as requesting a subprotocol, but the server itself doesn’t support that same subprotocol), or even an attempt at talking to a server location that isn’t a WebSocket (such as attempting to connect to ws://images.google.com/ )

Fundamentally, if you see a close code 1006 , you have a very low level error with WebSocket itself (similar to «Unable to Open File» or «Socket Error»), not really meant for the user, as it points to a low level issue with your code and implementation. Fix your low level issues, and then when you are connected, you can then include more reasonable error codes. You can accomplish this in terms of scope or severity in your project. Example: info and warning level are part of your project’s specific protocol, and don’t cause the connection to terminate. With severe or fatal messages reporting also using your project’s protocol to convey as much detail as you want, and then closing the connection using the limited abilities of the WebSocket close flow.

Be aware that WebSocket close codes are very strictly defined, and the close reason phrase/message cannot exceed 123 characters in length (this is an intentional WebSocket limitation).

But not all is lost, if you are just wanting this information for debugging reasons, the detail of the closure, and its underlying reason is often reported with a fair amount of detail in Chrome’s Javascript console.

Источник

Vscode cannot connect to remote Linux (_WebSocket close with status code 1006)

Remote connection to Linux. After entering the password, there are two prompts on the right

And the terminal cannot input
The remote directory could not be loaded

I had tried countless times in many ways Reinstall vocode,delete

/.vscode-server/ directory, and so on.
What the hell should I do.

9 Answers 9

  1. Find out which instance of WSL is running
  1. Terminate all running instances of WSL
  1. Then simply restart WSL

This can be resolved by rebooting the host machine (i.e. reboot your Windows PC) and restarting your WSL-2 box, then launching VSCode remote again.

No idea why this happens but from time to time I experience this issue.

Confirmed issue on:

I changed the setting remote.WSL.server.connectThroughLocalhost (Settings -> Extensions -> Remote — WSL -> Connect Through Localhost) from disabled to enabled, and that fixed the issue for me.

No idea why this happened in the first place though, it was working fine without enabling this setting for over 2 months, and then suddenly it stopped working.

Maybe the IP of the virtual machine changed in some unexpected way?

If anyone else comes across this question it’s very easy.

  1. You’re most likely using a reverse proxy
  2. Just enable websocket support on your reverse proxy.

Ex. If you are using Docker and the popular NGINX Proxy Manager; when you are adding a proxy host make sure to choose websocket support

No more 1006 error 🙂

Just clean up the /root/.vscode-server directory, vs code will create a new one when you connect again to the remote machine.

I had this issue as well. I used @thnee’s solution of changing the connection method. I found this easiest to do by using the settings UI > Remote > Connection Method

I think that may cause by the conflict between

/.ssh/known_hosts . I delete the

/.ssh/known_hosts file and try again, find that the vscode can connect to remote successly

setting ->terminal>integrated>default profile was null, i made it as sh this is the fix for it enter image description here

Источник

Remote connection to Linux. After entering the password, there are two prompts on the right

11

And the terminal cannot input
The remote directory could not be loaded

I had tried countless times in many ways
Reinstall vocode,delete ~/.vscode-server/ directory, and so on.
What the hell should I do.

22

Bashir's user avatar

Bashir

2,0475 gold badges18 silver badges43 bronze badges

asked Aug 16, 2021 at 8:25

sytlq's user avatar

3

  1. Find out which instance of WSL is running
wsl -l --running
  1. Terminate all running instances of WSL
wsl --shutdown
  1. Then simply restart WSL
wsl 

answered Mar 6, 2022 at 21:29

navarq's user avatar

navarqnavarq

9552 gold badges13 silver badges19 bronze badges

This can be resolved by rebooting the host machine (i.e. reboot your Windows PC) and restarting your WSL-2 box, then launching VSCode remote again.

No idea why this happens but from time to time I experience this issue.

Confirmed issue on:

Ubuntu 20.04
Vs code 1.60.1

answered Sep 19, 2021 at 22:12

Garbit's user avatar

GarbitGarbit

5,7206 gold badges38 silver badges72 bronze badges

3

I changed the setting remote.WSL.server.connectThroughLocalhost (Settings -> Extensions -> Remote — WSL -> Connect Through Localhost) from disabled to enabled, and that fixed the issue for me.

No idea why this happened in the first place though, it was working fine without enabling this setting for over 2 months, and then suddenly it stopped working.

Maybe the IP of the virtual machine changed in some unexpected way?

answered Sep 13, 2021 at 8:28

thnee's user avatar

thneethnee

5,8023 gold badges26 silver badges23 bronze badges

If anyone else comes across this question it’s very easy.

  1. You’re most likely using a reverse proxy
  2. Just enable websocket support on your reverse proxy.

Ex.
If you are using Docker and the popular NGINX Proxy Manager; when you are adding a proxy host make sure to choose websocket support

No more 1006 error :)

answered Mar 1, 2022 at 3:40

wildernessfamily's user avatar

Just clean up the /root/.vscode-server directory, vs code will create a new one when you connect again to the remote machine.

answered Sep 14, 2021 at 14:07

Jeevan Pawar's user avatar

I had this issue as well. I used @thnee’s solution of changing the connection method. I found this easiest to do by using the settings UI > Remote > Connection Method

answered Dec 15, 2021 at 14:30

Gib's user avatar

I think that may cause by the conflict between ~/.ssh/config and ~/.ssh/known_hosts. I delete the ~/.ssh/known_hosts file and try again, find that the vscode can connect to remote successly

Bashir's user avatar

Bashir

2,0475 gold badges18 silver badges43 bronze badges

answered Apr 19, 2022 at 2:32

Junjia Chen's user avatar

1

setting ->terminal>integrated>default profile was null, i made it as sh this is the fix for it enter image description here

answered Aug 2, 2022 at 6:34

rajendar's user avatar

1

I have this issue all of a sudden and after a few trials, I found install another distro using WSL-1 fixes the problem. You can safely unregister the new distro afterwards.

Dharman's user avatar

Dharman

29.3k21 gold badges80 silver badges131 bronze badges

answered Dec 15, 2021 at 2:17

Yizhe Zhan's user avatar

2

Summary

  • TL;DR
  • What is the websocket 1006 error?
  • Why do I see this error?
  • How to fix it?
    • Use the –link parameter to get a temporary https
      • Option 1 : get the link locally
      • Option 2 : Use ngrok

At the end of the installation of the code server, you are ready to enjoy your new development workflow, and then, you see this message “WebSocket close with status code 1006”. How to solve it? Check out these answers

Note: If you are confused about what code server is, check this post which explains it.

TL;DR

Check your https connection. Your browser cannot reach your code server instance.

What is the websocket 1006 error?

The websocket 1006 error means that the connection has been closed, locally, by your browser.

If you see a close code 1006, you have a very low level error with WebSocket itself as this error is not really meant for the user. The websocket 1006 error points to a low level issue with your code and implementation.

Why do I see this error?

The main reason is that the connection was closed abnormally (locally) by the browser implementation.

It means that your browser cannot reach your remote code server.
The main issue is about your https connection to the server.

How to fix it?

You might not be sure about the process to follow in order to setup code server. I did a tutorial on how to setup code server cloud IDE platform on digitalocean using kubernetes.

If you speak french, the french version is here.

The good news is that, there are two possible solutions :

Use the –link parameter to get a temporary https

Option 1 : get the link locally

code-server --host 127.0.0.1 --bind-addr 0.0.0.0:9000 --auth password --link

Option 2 : Use ngrok

ngrok will tunnel and create an https connection to your server.

code-server --host 127.0.0.1 --bind-addr 0.0.0.0:9000 --auth password ngrok http 9000

Use wss to forward

Here is the code to perform the forwarding and solve the issue

// forward websocket (wss -> ws)
httpsServer.on('upgrade', function (req, socket, head) {
  proxy.ws(req, socket, head, {
    target: 'ws://...',
    ws: true
  })
})

Hi, Binhex, I am use a lot of your app on my unraid. So far they are working so good. Thank a lot. Recently, 2 of my containers stop working. One is DelugeVPN and another is Code-server. I am runing code-server through swag follow your instruction. It runs good until yesterday. The log said:

2021-06-29 00:03:36.907411 [info] Host is running unRAID
2021-06-29 00:03:36.925185 [info] System information Linux edc35aebef02 5.10.28-Unraid #1 SMP Wed Apr 7 08:23:18 PDT 2021 x86_64 GNU/Linux
2021-06-29 00:03:36.948707 [info] OS_ARCH defined as 'x86-64'
2021-06-29 00:03:36.971340 [info] PUID defined as '99'
2021-06-29 00:03:37.009693 [info] PGID defined as '100'
2021-06-29 00:03:37.065151 [info] UMASK defined as '000'
2021-06-29 00:03:37.084929 [info] Permissions already set for '/config'
2021-06-29 00:03:37.121833 [info] Deleting files in /tmp (non recursive)...
2021-06-29 00:03:37.144496 [info] PASSWORD defined as '*****************'
2021-06-29 00:03:37.164598 [info] CERT_PATH not defined,(via -e CERT_PATH)
2021-06-29 00:03:37.186751 [info] CERT_KEY_PATH not defined,(via -e CERT_KEY_PATH)
2021-06-29 00:03:37.206839 [info] SELF_SIGNED_CERT defined as 'no'
2021-06-29 00:03:37.229365 [info] BIND_CLOUD_NAME not defined,(via -e BIND_CLOUD_NAME)
2021-06-29 00:03:37.274174 [info] Starting Supervisor...
2021-06-29 00:03:37,541 INFO Included extra file "/etc/supervisor/conf.d/code-server.conf" during parsing
2021-06-29 00:03:37,541 INFO Set uid to user 0 succeeded
2021-06-29 00:03:37,545 INFO supervisord started with pid 8
2021-06-29 00:03:38,547 INFO spawned: 'shutdown-script' with pid 105
2021-06-29 00:03:38,548 INFO spawned: 'start-script' with pid 106
2021-06-29 00:03:38,548 INFO reaped unknown pid 9 (exit status 0)
2021-06-29 00:03:39,233 DEBG 'start-script' stdout output:
[2021-06-28T17:03:39.232Z] info code-server 3.10.2 387b12ef4ca404ffd39d84834e1f0776e9e3c005

2021-06-29 00:03:39,233 INFO success: shutdown-script entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2021-06-29 00:03:39,233 INFO success: start-script entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2021-06-29 00:03:39,233 DEBG 'start-script' stdout output:
[2021-06-28T17:03:39.233Z] info Using user-data-dir /config/code-server/user-data

2021-06-29 00:03:39,242 DEBG 'start-script' stdout output:
[2021-06-28T17:03:39.242Z] info Using config file /config/code-server/config/config.yml
[2021-06-28T17:03:39.242Z] info HTTP server listening on http://0.0.0.0:8500

2021-06-29 00:03:39,242 DEBG 'start-script' stdout output:
[2021-06-28T17:03:39.242Z] info - Authentication is enabled
[2021-06-28T17:03:39.242Z] info - Using password from $PASSWORD
[2021-06-28T17:03:39.242Z] info - Not serving HTTPS

I cannot run code-server anymore, until I change it all back to default settings. I am sure that it was working until yesterday.

The non-working app is delugeVPN, I will post the symtom to the support thread.

Thanks if you can point me to the right direction.

Long VU.

Recently (in Q1 2020), SAP released SAP BAS (Business Application Studio), the new cloud-based Integrated development environment for SAP’s Multi-cloud environment. We can call as next generation intelligent SAP Web IDE.

You can read more about SAP Business Application Studio here.

In this blog, I would like to spread the awareness and share my experience how we can easily start using SAP BAS with free trial account. There are blogs and tutorials available, so you can easily start your SAP BAS for the first time. If you are familiar with visual studio code, then you will find it easier as it is being created on an open source IDE – “Eclipse Theia”, which embraces Microsoft Visual Studio Code experience.

Let’s start SAP BAS. First of all, create your SAP Cloud Platform free trial account. Get a Free Trial Account on SAP Cloud Platform

Guide to Start SAP Business Application Studio on Trial

Now, I will write steps to start SAP BAS. You can alternatively follow SAP Developer tutorial here to setup SAP BAS.

  1. Go to https://cockpit.hanatrial.ondemand.com/cockpit#/home/trial.
  2. Enter your trial account and check you subscriptions. You have to subscribe first.
  3. Go to the SAP BAS and you can create Dev Spaces according to your type of application development.
  4. Select application type and give dev space name. Within a minute, you will see your space is up and running.
  5. Now, it’s time to start with new level of development experience.

SAP has created a central blog with many links, useful information and hands-on experiences from developers community. Although you are using SAP Web IDE for long time and you can continue to do so, but I recommend to check the new SAP BAS and feel the thrill of new development experience and make yourself future ready.

Guide to contribute to SAP BAS Tutorial

Now, I will take you through the process how you can contribute to the BAS application while you are doing some hands-on. As this is new application development platform, you may face some issues while using it and also you may feel some functionalities are good to have within BAS. If you have a bug or an idea, please enter them here, it is advisable that before you create new issue please browse the open issues to avoid duplication. Your issues will help to enhance the application and make the tutorial content bug-free as well.

Понравилась статья? Поделить с друзьями:
  • The witcher application load error 5 0000065434
  • The vpn connection is not allowed via a local proxy как исправить
  • The witcher 3 фикс файл для проблем со script compilation error
  • The vpn connection failed due to unsuccessful domain name resolution как исправить ошибку
  • The witcher 3 ошибка msvcr120 dll