Node.js

Monitoring for node-cron and Node.js scheduled tasks

node-cron and similar in-process schedulers run inside your Node app. That is convenient until the process crashes, gets redeployed, or the task throws — because when the process stops, the schedule stops with it, silently. A heartbeat tells you the moment a scheduled task stops checking in.

The problem with in-process schedulers

When your schedule lives inside the app process, its reliability is tied to that process. A crash, an OOM kill, a rolling deploy, or an unhandled rejection can stop the timer without a single error surfacing anywhere you would notice. Nothing outside the process knows the job was supposed to run.

Add a heartbeat to node-cron

Wrap the task so it pings on success and never lets the ping itself break the job:

scheduler.js
import cron from 'node-cron';

cron.schedule('0 * * * *', async () => {
  try {
    await runHourlyJob();
    await fetch('https://cronmint.com/ping/YOUR-TOKEN');   // check in on success
  } catch (err) {
    console.error('job failed', err);
    // no ping -> Cronmint alerts you about the missed run
  }
});

Handle transient failures

Not every blip deserves an alert. Give the job a small retry, and only skip the heartbeat when it truly fails. Cronmint’s own retry and alert thresholds mean one flaky run will not page you, but a genuinely stuck job will.

Monitor your Node.js scheduled tasks

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

Start free

Frequently asked questions

How do I monitor node-cron jobs?

Ping a heartbeat URL from inside the scheduled callback after the work succeeds, and create a matching heartbeat monitor. If the process dies or the job throws, the ping stops and you get alerted.

What if my Node process crashes?

That is exactly what a heartbeat catches. A crashed process cannot send its next check-in, so the monitor flags the missed run even though no error was logged.

Does this work with other Node schedulers?

Yes. The pattern — ping on success, skip on failure — works with node-cron, node-schedule, Agenda, BullMQ repeatable jobs, or a plain setInterval.