Healthchecks failing in deployment although manual query of them works
benisenstein
PROOP

5 months ago

Hello and hope all is well! I'm in the process of setting up healthchecks on all services in my project, started with 2 of them as a first step. The healthchecks failed, although I can manually send a request to them and get a 200 response. They are built using the Dockerfile method. I wonder how I can debug the healthchecks? The build log says "Attempt #X failed with service unavailable" However the build logs show that it has successfully started. Any advice?

Project ID: cd22524a-2d8b-4ec7-8ea5-bedb4df89632

Service IDs:
522605ae-2192-40ff-89bb-d1d5582c6c4a

2e6b2651-d1b5-4ae1-a854-2b6460b8f540

$10 Bounty

3 Replies

benisenstein
PROOP

5 months ago

One suspicion is that the services' own internal auth is rejecting the request from the healthcheck.railway domain. I wonder whether more configuration of the healthchecks (adding bearer tokens, writing a custom shell script a la Docker Compose) is a worthwhile feature request to make?


fra
HOBBYTop 10% Contributor

5 months ago

I know is not great but you can just bypass the auth if the request is coming from healthcheck.railway.app? or you can even add a token in the path, something like /health?token=123 and check for the token + the domain? also, is your endpoint resolving quickly?


case
PRO

5 months ago

@benisenstein Can you share your Dockerfile so that we can see what it looks like? (or the relevant portions of it)

And also, can you share the HTTP server code that is handling your healthchecks?

For example, this is what my server side looks like:

if (req.url === "/healthz") {
      res.writeHead(200, { "Content-Type": "text/plain" });
      res.end("OK");
}

…and this is what's in my Railway config file:

"deploy": {
    "healthcheckPath": "/healthz",
    "healthcheckTimeout": 60,
}

There may be other issues, e.g. what port your app is listening on, and if Railway is configured to listen to that port, etc.


Loading...