code-server stopped loading after upgrading coder to 2.8.1
Previous version: 2.7.2
code-server version: 4.20.1
: This is as same before the upgrade
I use this to start code-server: code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
When I open the coder resource I get 502 error- Failed to proxy request to application: proxyconnect tcp: dial context: connect tcp [fd7a:115c:a1e0:481e:b8c0:a53:c24:11b4]:8080: connection was refused
If I remove the --port param and use the default 8080 then it loads fine.
I read through the release notes and cannot figure out what I am missing. Appreciate any pointers! TIASolution:Jump to solution
I've stumbled upon this as well and I think I found the solution.
We're using Microsoft VSCode (not code-server by Coder) - currently
Visual Studio Code 1.87.0
The VSCode web button stopped working: ...20 Replies
<#1206785446127079434>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
I don't know how the update triggered that but you should check your template for code-server's
coder_app
definition, i think it's likely that your port is set to 8080 there@Phorcys Thanks for the response. I checked that. There were no changes done to the template. The only change I made was upgrade coder server. I am behind corp proxy if that helps
This is my recource definition:
resource "coder_app" "code-server" {
agent_id = coder_agent.main.id
slug = "code-server"
display_name = "code-server"
url = "http://localhost:13337/?folder=/home/coder/"
icon = "/icon/code.svg"
# subdomain = false
# share = "owner"
healthcheck {
url = "http://localhost:13337/healthz"
interval = 3
threshold = 10
}
This is the error log from coder-agent.log:
2024-02-13 17:38:44.068 [debu] net.tailnet.net.netstack: netstack: could not connect to local server at 127.0.0.1:8080: dial tcp 127.0.0.1:8080: connect: connection refused
that's weird
can you send a screenshot of your browser window when the "failed to proxy request" error occurs ?
browserUrl: https://coder.XXX/abc-user/abc-workspace.main/apps/code-server/?folder=/home/coder/
I have no idea why 8080 works and not other ports. I created another copy of the template and install vs-code web following direction here and I get the same behavior. One thing I noticed- when I run code-server on 8080 and tried running any other app (java for e.g) none of those ports are accessible even though the application is running. This makes me think something broke in port forwarding
Web IDEs - Coder v2 Docs
Learn how to configure web IDEs in your templates
I think I see what's going on
can you access the workspace via the web terminal ?
Yep
Also no issues in vscode desktop. Everthing works fine there
@Phorcys any pointers?
hey, sorry
i thought your whole networking to the workspace was causing issues
does your container have the
NET_ADMIN
capability ?
you might also need NET_RAW
I think so, I can get help if needed. Could you elaborate more? Dont really get all the networking stuff
capabilities are a linux thing basically
https://man7.org/linux/man-pages/man7/capabilities.7.html
but it depends on your environment
are you running your workspaces under docker ?
yes
are you using some kind of specific docker setup ?
like docker configured to be rootless or podman
nope, standard docker. no changes in the version or setup before or after the upgrade
could you send the full coder-agent log ?
yes, give me a few..
I created a new workspace
re: NET_ADMIN I added this to the workspace container via the docker terraform resource. It did not help. I verified capabilities with pscap
Solution
I've stumbled upon this as well and I think I found the solution.
We're using Microsoft VSCode (not code-server by Coder) - currently
Visual Studio Code 1.87.0
The VSCode web button stopped working:
not sure when this started happening but I was updating Coder and noticed the web IDE was no longer opening. I'm sure it was some VSCode update.
This is the command we were running:
I checked the ports exposed inside the container using sudo netstat -tulp
and found that VSCode was binding to ::1
which is the localhost for IPv6. As mentioned before, at the agent log above, Coder tries to use 127.0.0.1
, which is localhost for IPv4.
The solution is telling code-server to bind to specific interface/ip like so:
And now it should be working as before 🙂
p.s. I'm not entirely sure why localhost
in .tf file resolves to 127.0.0.1 via CoderYes we noticed this and we did a similar workaround in https://github.com/coder/modules/pull/216
GitHub
fix(vscode-web): set
--host 127.0.0.1
by matifali · Pull Request ...MS code-server defaults to using --host localhost, which worked perfectly with Coder.
But recently Coder is failing to proxy vscode-web with the coder/coder#12790
As a workaround, setting --host 12...
hey @coder_pie, sorry, I forgot about this
you should check out the solution mentioned if you still had issues