Published October 21, 2026
How to Monitor BullMQ, node-cron, and Agenda
A Node process can stay up while the scheduled function never runs. BullMQ's scheduler lives in the queue backend, and nothing calls the worker. node-cron's timer lives in the process, and the process is gone. Agenda's row sits in the database, and start() was never called, or the lock from a crash has not expired. The HTTP server still returns 200.
This page is those three failure shapes, and a ping that runs only after the work succeeds. The ping uses fetch and AbortSignal.timeout. A timeout or a network error is swallowed, so a monitoring hiccup does not fail the job. The generic Node and Python wrappers are on the Node docs and the Node and Python guide. Behavior below is from the BullMQ docs, the node-cron README, and the Agenda README as of October 2026.
The same silence on a platform cron is Render, Railway, and Fly.io. A Linux crontab is crontab not running.
Three clocks, three places the run can die
| Scheduler | Where the schedule lives | If the process is down |
|---|---|---|
| BullMQ job scheduler | The queue backend. Redis is the default. | The delayed job waits. It does not stack one copy per missed interval. |
| node-cron | The Node process. It does not persist the schedule. | Those ticks are gone. Nothing replays them on the next boot. |
| Agenda | The backend. MongoDB is the default, collection agendaJobs. |
The row stays. Nothing runs it until a processor calls start(). |
A ping inside the scheduler, at the moment of enqueue or at cron.schedule, stays green when the body never finishes. Put it at the end of the body.
AbortSignal.timeout aborts after the given milliseconds. fetch rejects on a network error and on that abort. It does not reject on an HTTP error status. This helper catches the rejection and does not read the status, so neither one fails the job. If the ping never lands, the check alerts after grace. The samples below call ping. exportRows is the job body.
async function ping(path = "") {
const raw = process.env.CRONNUDGE_URL;
if (!raw) return;
try {
await fetch(raw + path, {
method: "POST",
signal: AbortSignal.timeout(10_000),
});
} catch {
// The work's result stands. A missed ping alerts after grace.
}
}
BullMQ job schedulers
upsertJobScheduler is the Job Scheduler API. The repeat option on Queue.add was deprecated in BullMQ 5.16.0 and removed in v6, along with getRepeatableJobs, removeRepeatable, and removeRepeatableByKey. v6 keeps upsertJobScheduler, getJobSchedulers, and removeJobScheduler.
The first argument is the scheduler id. Upserting that id again updates the scheduler. It does not create a second one. A different id is a different scheduler, and both will produce jobs.
import { Queue, Worker } from "bullmq";
const connection = { host: "localhost", port: 6379 };
const queue = new Queue("nightly", { connection });
await queue.upsertJobScheduler(
"nightly-export",
{ pattern: "0 15 3 * * *", tz: "UTC" },
{ name: "export", data: {} },
);
const worker = new Worker(
"nightly",
async () => {
await exportRows();
await ping();
},
{ connection },
);
The documented pattern has six fields, seconds first. 0 15 3 * * * is 03:15. CronNudge stores five fields, so the check is 15 3 * * * with the same zone. tz evaluates the pattern in an IANA timezone. The old repeat.utc flag is gone. Use tz: "UTC" when the schedule is UTC.
every is a millisecond interval, and it cannot be combined with pattern. every: 1000 is one second. every: 60000 is one minute. A new scheduler that uses every runs its first repetition immediately, from BullMQ 5.19.0 on. The immediately option is deprecated, and that is the behavior. A later upsert of the same id does not fire an extra immediate run. It follows the interval.
The scheduler produces the next job when the last one begins processing. There is one delayed job for that scheduler while it is producing. If the queue is busy, or there are not enough workers, jobs arrive less often than the interval. A worker that is not running does not build a backlog of one job per missed tick. The legacy repeatable page says the same thing in fewer words: if there are no workers running, repeatable jobs will not accumulate when a worker comes back.
A Queue needs a connection. With no options, BullMQ uses port 6379 on localhost. The default backend is Redis. A PostgreSQL backend also ships. Either way, a worker that cannot reach the backend never calls the processor, and the success ping never runs. The connections page says to set Redis maxmemory-policy to noeviction. Evicting keys causes unexpected errors in BullMQ.
getJobSchedulers is the list. Two ids for one task is the duplicate. removeJobScheduler drops the extra id. Calling upsertJobScheduler on boot with a stable id is the update path, not a second schedule.
The older repeat option
On BullMQ v5, before the v6 removal, Queue.add accepted repeat. The same repeat options were not added twice. A different jobId, or a custom repeat.key, was a second schedule, even when the cron string matched. Every time a repeatable job was picked up, the next delayed job was added. From BullMQ 2.0 on, a separate QueueScheduler was not required.
That code path is the one v6 refuses. Migrate while you are still on v5: read getRepeatableJobs(), create the matching upsertJobScheduler, then removeRepeatable or removeRepeatableByKey. v6 raises if it still finds the old metadata.
node-cron
node-cron v4 schedules in the process. cron.schedule starts the task immediately. There is no scheduled option and no runOnInit. cron.createTask is the stopped form. task.start() runs it. The README is explicit that node-cron does not persist state to a database. A process that is down does not store the fires it missed, and the next boot does not replay them.
import cron from "node-cron";
cron.schedule(
"15 3 * * *",
async () => {
await exportRows();
await ping();
},
{ name: "nightly-export", timezone: "UTC", noOverlap: true },
);
Five fields are minute, hour, day of month, month, day of week. An optional seconds field goes in front. 15 3 * * * is 03:15. timezone defaults to the system zone and accepts an IANA name that Intl.DateTimeFormat knows. Set it, and put that same name on the check. Across a daylight-saving fall-back, the repeated hour runs once. The skipped and repeated hours for other schedulers are in cron jobs and daylight saving time.
noOverlap defaults to false. Set true and a tick that arrives while the previous run is still going is skipped. The task emits execution:overlap and does not call the function, so it does not ping. A stuck run then goes late after grace, which is the alert you want.
execution:missed is a live process, not a dead one. The timer woke late, or the event loop was blocked. The tolerance is missedExecutionTolerance, default 1000 milliseconds. A wake inside that window still runs. A later wake is reported as missed and does not run the function. There is no ping for that tick.
distributed defaults to false, so every process that schedules the task runs it. Set distributed: true and a name, and only one instance runs each fire. The default coordinator is the NODE_CRON_RUN environment flag. An instance that is not elected emits execution:skipped with reason not-elected and does not run. Reason coordinator-error fails closed: that instance skips too. Only the instance that actually ran the function should ping.
unref: true takes the timer out of the set of handles that keep Node alive. The default is false. A task that is unref'd, in a process whose other work has finished, stops when the process exits. That is the same miss as a process that was never started.
Agenda
Agenda stores jobs in a backend. MongoDB is the default, through MongoBackend, in the agendaJobs collection unless you rename it. every() writes one job of type single. Running that line again, including on every boot, does not insert a second row for the same name. A second name is a second job.
The processor does nothing until start(). start() has to run after processEvery and before every(). A web process that defines the job and never starts the processor leaves the row unread. processEvery is how often Agenda looks for due jobs. That section of the README gives the default as '5 seconds'.
import { Agenda } from "agenda";
import { MongoBackend } from "@agendajs/mongo-backend";
const address = process.env.MONGODB_URI;
if (!address) throw new Error("MONGODB_URI is not set");
const agenda = new Agenda({
backend: new MongoBackend({ address }),
});
agenda.define("nightly-export", async () => {
await exportRows();
await ping();
});
await agenda.start();
await agenda.every("15 3 * * *", "nightly-export", {}, {
timezone: "UTC",
skipImmediate: true,
});
15 3 * * * is a cron string, five fields, 03:15. timezone is a name moment-timezone accepts, and it applies to cron strings. skipImmediate defaults to false, which runs the job at definition time as well as on the interval. true waits for the schedule. The check should expect the cron, not an extra run at boot, so the sample sets true.
Several processors can share the backend. A lock stops two of them taking the same job. defaultLockLifetime is 10 minutes, in milliseconds on the override. The lock releases when the handler's promise settles. stop() unlocks jobs it still holds. A crash does not call stop(). The row stays locked until the lifetime expires, and no other processor runs it. That gap does not throw in the process that already died.
A repeating job with a backoff configured retries immediately on failure, rather than waiting for the next cron tick. The success ping still waits for a handler that finishes. disable() keeps a matching job from running. The row is still there.
If the process cannot reach the backend, it cannot lock the job. The handler does not run. The ping does not run.
Where the ping goes
Call ping() after the work, in the worker, the node-cron function, or the Agenda definition. Do not call it when you upsert the scheduler or when you cron.schedule. One check per job. A shared URL stays up while any other job still pings. The helper above is what those samples call. A network error or an abort is swallowed. An HTTP error status does not reject fetch, so it does not fail the job either.
/fail on the same id marks the check down and alerts immediately when it was not already down. /start records a start. It is not a success. Max runtime, when run tracking is on, is in assertions, runs, and agents. Re-throw the work error. The ping helper cannot be the thing that throws.
async function runExport() {
try {
await ping("/start");
await exportRows();
await ping();
} catch (error) {
await ping("/fail");
throw error;
}
}
Use this block or the success-only call, not both, or a success pings twice. An exception you swallow is a successful job, and /fail is the only signal left. Skip /fail if you would rather wait out retries and alert only when the success ping never arrives.
Schedule and grace
Copy the five fields the scheduler evaluates, and the timezone from the section above. A BullMQ pattern drops its leading seconds field. A node-cron or Agenda five-field string is already the check expression. Put the zone on the check. UTC when you passed UTC. The system zone only when node-cron is actually using the default.
An every interval, in BullMQ or Agenda, is an interval check when it is a fixed gap rather than cron. The form lists 5 minutes, 15 minutes, 30 minutes, 1 hour, 6 hours, 1 day, and 1 week. The API accepts any whole number of seconds from the plan minimum through 31 days. Every minute needs Pro. Free's shortest interval is 5 minutes. A one-second BullMQ every is not a period the check can store.
Default grace is 5 minutes. The form offers none, 1 minute, 5 minutes, 15 minutes, and 1 hour. The API accepts 0 seconds through 7 days. The ping is at the end, so grace covers queue time plus runtime. A short daily export fits 15 minutes. A body that runs longer than that needs the 1 hour option.
Free is 10 checks, with email and one Slack or Discord channel. Pro is $12 a month for 100 checks, a 1 minute minimum, signed webhooks, and the API. There is no yearly price. The numbers are on pricing.
Compare the five fields on the cron tool in the zone you set. The next runs should match the clock the scheduler uses.
FAQ
Does BullMQ alert when no worker is consuming? No. The scheduler can keep a delayed job while every worker is down or pointed at another queue. There is no page from BullMQ. The alert is the success ping that never arrives.
Do missed BullMQ runs pile up after a worker comes back? No. A job scheduler keeps one delayed job and creates the next when that job begins processing. The legacy repeatable API says the same thing: with no workers running, repeatable jobs do not accumulate. You get the waiting job, not one job per tick that passed while the worker was gone.
Why did the same task schedule twice?
Two BullMQ scheduler ids are two schedulers. Upserting the same id updates the one scheduler. On the old repeat option, a different jobId or repeat.key was a second schedule even when the cron matched. node-cron runs once per process unless distributed is true. Agenda's every() keeps a single row per name.
Which timezone goes on the check?
The zone the scheduler uses to read the expression. That is tz for a BullMQ pattern, timezone for node-cron (the system zone if you omit it), and timezone for an Agenda cron string. A six-field BullMQ pattern includes seconds. Paste the other five fields.
Does a failed ping fail the job?
Not with the helper above. fetch rejects on a network error or an abort from AbortSignal.timeout. The catch swallows that. An HTTP error status does not reject. The work's result is unchanged, and the check alerts after grace if the ping never landed.
What if Redis or MongoDB is down? BullMQ's default backend is Redis, and a worker that cannot reach it does not run the processor. Agenda cannot lock a job it cannot read. In both cases the handler never finishes, so the success ping never runs. node-cron has no database in this path. Its failure is a process that is not running the timer.
The schedule is in Redis, in the process, or in Mongo. The ping is how you hear that the body finished. Create the check, or compare the five fields on the cron tool. Related: how to monitor cron jobs, crontab not running, cron expression examples, and Cloud Scheduler and Cloud Run when the schedule is Google's, not Node's.