Menu

Post image 1
Post image 2
1 / 2
0

Your Next.js health check is lying to you (and how to fix it)

DEV Community·ohyeah·about 1 month ago
#PSwhMfQZ
#nextjs#webdev#devops#health#real#next
Reading 0:00
15s threshold

I've been monitoring my own SaaS in production for the last two months, and I've watched the same bug pattern hit indie projects over and over: The app is on fire. Customers are seeing 500s. Stripe webhooks are silently failing. And yet GET /api/health is cheerfully returning 200 OK , every minute, like nothing's wrong. The reason is almost always the same: the health check is testing the wrong thing. This post is about what a health check should actually do, the three failure modes that catch people, and a working Next.js 13+ implementation you can paste in. The "useless 200" pattern Here's the health check I see most often in indie Next.js codebases: // src/app/api/health/route.ts export async function GET () { return Response . json ({ ok : true }); } Enter fullscreen mode Exit fullscreen mode This endpoint can only fail in one way: the Next.js process itself is dead. If that happens, your hosting platform was already going to know — Vercel/Render/Fly notice the process crashed before your monitor does.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More