Healthcheck not working

joeyiny
PRO

7 months ago

I'm going crazy.

Platform: Next.js 14
Turborepo

For some reason the healthcheck isn't working, even though I believe its configured properly.

Endpoint: /api/health

the code:
```import { NextResponse } from "next/server";
export const dynamic = "force-dynamic";
export const runtime = "nodejs";

export async function GET() {
return NextResponse.json({ status: "ok" }, { status: 200 });
}```

If i visit localhost:3000/api/health I get a 200 response no problem.

Any help?

View Deploy details

ⓘ Deployment information is only viewable by project members and Railway employees.

Awaiting User Response

3 Replies

7 months ago

Hello,

I see a couple things wrong with your setup.

1. You have set your build command to be a start command in the service settings.
2. Your start command is building your app when the build command should be doing that.

Fix these issues and then we will go from there!


Status changed to Awaiting User Response railway[bot] 7 months ago


brody

Hello, I see a couple things wrong with your setup.1. You have set your build command to be a start command in the service settings.2. Your start command is building your app when the build command should be doing that.Fix these issues and then we will go from there!

joeyiny
PRO

7 months ago

Can you clarify?

Where do you see this?


Status changed to Awaiting Railway Response railway[bot] 7 months ago


7 months ago

So at the moment, your build step is happening when it's deployed, this means that when Railway runs to check your application to see if it's running, it comes alive after the healthcheck. Which is why it's serving but marked as failed.

I would check your turbo config to see if this is the case.



When I see the deploy logs- I see pages being built which arguably should be in the build step. Which lead me to believe that will confuse the Healthcheck.

Attachments


Status changed to Awaiting User Response railway[bot] 7 months ago


Healthcheck not working - Railway Help Station