Next.js

Cron monitoring for Next.js apps

Next.js apps usually run scheduled work through Vercel Cron or an external trigger hitting a route handler. Either way, the framework gives you no alert when that scheduled call errors or never arrives. A heartbeat added to your route turns silent failures into notifications.

How cron works in Next.js

A Next.js route handler does the scheduled work; something on the outside triggers it on a schedule — Vercel Cron, an external cron service, or a queue. None of these trigger sources alert you when the run fails or is skipped, and the App Router does not add monitoring of its own.

Add a heartbeat to your route handler

Ping Cronmint after the work completes so only successful runs check in. Protect the route with a secret if it is publicly reachable.

app/api/cron/digest/route.ts
export async function GET(req: Request) {
  const auth = req.headers.get('authorization');
  if (auth !== `Bearer ${process.env.CRON_SECRET}`) {
    return new Response('Unauthorized', { status: 401 });
  }

  await sendDailyDigest();
  await fetch('https://cronmint.com/ping/YOUR-TOKEN');   // check in on success

  return Response.json({ ok: true });
}

Whatever triggers it

The same route works whether Vercel Cron, GitHub Actions, or an external scheduler calls it — the heartbeat is what makes the run observable. If you are on Vercel specifically, the Vercel cron monitoring guide covers the vercel.json wiring.

Monitor your Next.js scheduled routes

5 jobs free, no card. Set up your first monitor in about 30 seconds.

Start free

Frequently asked questions

How do I monitor cron jobs in a Next.js app?

Add a heartbeat ping at the end of the route handler that does the scheduled work, and create a matching heartbeat monitor. Errors or skipped runs stop the check-in and trigger an alert.

Does it matter what triggers the route?

No. Vercel Cron, an external cron service, or a queue can trigger it — the heartbeat inside the route is what provides the monitoring.

How do I secure the cron route?

Require a secret header (e.g. a Bearer token from an env var) so only your scheduler can invoke it, and ping the heartbeat only after a successful, authorized run.