Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Health check failure is confusing #4943

Closed
@ammario

Description

@ammario

I created a fresh Coder deployment, added the docker-code-server template, and my code-server app is stuck in the Initializing... state.

The resource is configured as such:

resource "coder_app" "code-server" {
  agent_id     = coder_agent.main.id
  slug         = "code-server"
  display_name = "code-server"
  url          = "http://localhost:8080/?folder=/home/coder"
  icon         = "/icon/code.svg"
  subdomain    = false
  share        = "owner"

  healthcheck {
    url       = "http://localhost:8080/healthz"
    interval  = 3
    threshold = 10
  }
}

But, when I curl the health check endpoint within the workspace, it reports 200:

coder@test-1:~$ curl -v 127.0.0.1:8080/healthz
*   Trying 127.0.0.1:8080...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /healthz HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Content-Length: 50
< ETag: W/"32-bnbntZrd4z8IPIgEbmlsZvjOOyQ"
< Vary: Accept-Encoding
< Date: Mon, 07 Nov 2022 22:56:27 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
<
* Connection #0 to host 127.0.0.1 left intact
{"status":"expired","lastHeartbeat":1667861611004}

I found this in /tmp/coder-agent.log:

2022-11-07 23:01:44.510 [ERROR]	<./agent/apphealth.go:137>	NewWorkspaceAppHealthReporter.func1	failed to report workspace app stat ...
  "error": POST https://fcca82996ca86b1a46d910c0d64dbdb6.pit-1.try.coder.app/api/v2/workspaceagents/me/app-health: unexpected status code 404: Error setting workspace app health
           	Error: workspace app name  not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions