#Healthcheck runs after building, before start NextJS

3 messages · Page 1 of 1 (latest)

wild oasis
#

App builds successfully, then the healthcheck starts, but it should after the run command. Is this a bug?

timid sonnetBOT
#

New reply sent from Central Station thread:

It’s not necessarily a bug—more a timing or configuration issue.
Most PaaS/container platforms start the health-check
as soon as the container port becomes reachable
, regardless of whether your
RUN
command has finished its own internal start-up logic.
So the sequence you see is:

  1. Image builds → OK
  2. Container is started → port 8080 (or whatever you exposed) is bound almost immediately
  3. Platform begins health-checks → may fail if your app hasn’t actually finished initialising
  4. Your
    RUN
    command finally finishes initialising → health-check would succeed if the platform hadn’t already killed the container

You're seeing this because this thread has been automatically linked to the Central Station thread.

timid sonnetBOT
#

New reply sent from Central Station thread:

Can you provide build logs here.
Adding a startup delay or readiness probe
inside your app (e.g., only respond 200 OK after initialization).
Or, if Railway lets you,
increase the healthcheck timeout or interval
.

You're seeing this because this thread has been automatically linked to the Central Station thread.