Coder envbuilder container starts logging 401 errors when using "Update" option

I am seeing an issue where when I use the "Update" option in the coder dashboard after a template change, the coder process get stuck in this state, where it gets 401 errors trying to talk to the coder agent URL. The issue is resolved by using the "Restart" option instead.
2024-06-12 19:43:20.920 [info] connecting to coderd
2024-06-12 19:43:20.934 [warn] run exited with error ...
error= GET https://coder.example.com/api/v2/workspaceagents/me/rpc?version=2.1: unexpected status code 401: unexpected non-JSON response "": Try logging in using 'coder login'.
Error: no response body
2024-06-12 19:43:20.920 [info] connecting to coderd
2024-06-12 19:43:20.934 [warn] run exited with error ...
error= GET https://coder.example.com/api/v2/workspaceagents/me/rpc?version=2.1: unexpected status code 401: unexpected non-JSON response "": Try logging in using 'coder login'.
Error: no response body
I am using "token" authentication with the coder agent, with config passed to the container for the auth as :
{
name = "CODER_AGENT_TOKEN"
value = try(coder_agent.main[0].token, "")
},
{
name = "CODER_AGENT_URL"
value = data.coder_workspace.me.access_url
},
{
name = "CODER_AGENT_TOKEN"
value = try(coder_agent.main[0].token, "")
},
{
name = "CODER_AGENT_URL"
value = data.coder_workspace.me.access_url
},
7 Replies
Codercord
Codercord3mo ago
<#1250538421789790271>
Category
Bug report
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys3mo ago
could you send your template over? I think CODER_AGENT_URL might be wrong in your case
Aaron Taylor
Aaron Taylor2mo ago
That would make certainly make sense based on the error, though I'm not sure where it might be going wrong, we set that variable as:
{
name = "CODER_AGENT_URL"
value = data.coder_workspace.me.access_url
},
{
name = "CODER_AGENT_URL"
value = data.coder_workspace.me.access_url
},
File is attached here.
Phorcys
Phorcys2mo ago
do you use anything like Cloudflare Access or any SSO provider that might gate the API requests?
Aaron Taylor
Aaron Taylor2mo ago
No, our API is behind a GCP application-layer load balancer, but it doesn't do any auth
Phorcys
Phorcys2mo ago
i'm not so sure, I think you should open an issue over at the envbuilder repo
GitHub
GitHub - coder/envbuilder: Build development environments from a Do...
Build development environments from a Dockerfile on Docker, Kubernetes, and OpenShift. Enable developers to modify their development environment quickly. - coder/envbuilder
Aaron Taylor
Aaron Taylor2mo ago
GitHub
401 error for requests to coder.example.com after "Update" option f...
I am seeing an issue where when I use the "Update" option in the coder dashboard after a template change, the coder process get stuck in this state, where it gets 401 errors trying to tal...
Want results from more Discord servers?
Add your server