C
Coder.com•11mo ago
coder_pie

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! TIA
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: ...
Jump to solution
20 Replies
Codercord
Codercord•11mo ago
<#1206785446127079434>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys•11mo ago
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
coder_pie
coder_pieOP•11mo ago
@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
Phorcys
Phorcys•11mo ago
that's weird can you send a screenshot of your browser window when the "failed to proxy request" error occurs ?
coder_pie
coder_pieOP•11mo ago
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
No description
Phorcys
Phorcys•11mo ago
I think I see what's going on can you access the workspace via the web terminal ?
coder_pie
coder_pieOP•11mo ago
Yep Also no issues in vscode desktop. Everthing works fine there @Phorcys any pointers?
Phorcys
Phorcys•11mo ago
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
coder_pie
coder_pieOP•11mo ago
I think so, I can get help if needed. Could you elaborate more? Dont really get all the networking stuff
Phorcys
Phorcys•11mo ago
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 ?
coder_pie
coder_pieOP•11mo ago
yes
Phorcys
Phorcys•11mo ago
are you using some kind of specific docker setup ? like docker configured to be rootless or podman
coder_pie
coder_pieOP•11mo ago
nope, standard docker. no changes in the version or setup before or after the upgrade
Phorcys
Phorcys•11mo ago
could you send the full coder-agent log ?
coder_pie
coder_pieOP•11mo ago
yes, give me a few..
coder_pie
coder_pieOP•11mo ago
I created a new workspace
coder_pie
coder_pieOP•11mo ago
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
modrin
modrin•9mo ago
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:
2024-04-22 16:08:52.629 [debu] net.tailnet.net.netstack: netstack: could not connect to local server at 127.0.0.1:8000: dial tcp 127.0.0.1:8000: connect: connection refused
2024-04-22 16:08:52.629 [debu] net.tailnet.net.netstack: netstack: could not connect to local server at 127.0.0.1:8000: dial tcp 127.0.0.1:8000: connect: connection refused
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:
code-server serve-local --accept-server-license-terms --without-connection-token &>/tmp/code-server.log 2>&1 &
code-server serve-local --accept-server-license-terms --without-connection-token &>/tmp/code-server.log 2>&1 &
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:
code-server serve-local --accept-server-license-terms --without-connection-token --host 127.0.0.1 &>/tmp/code-server.log 2>&1 &
code-server serve-local --accept-server-license-terms --without-connection-token --host 127.0.0.1 &>/tmp/code-server.log 2>&1 &
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 Coder
Atif
Atif•9mo ago
Yes 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...
Phorcys
Phorcys•8mo ago
hey @coder_pie, sorry, I forgot about this you should check out the solution mentioned if you still had issues

Did you find this page helpful?