← Integration guides
Monitor a Node.js job
Native fetch (Node 18+) — works with node-cron, Agenda, BullMQ, or a bare interval.
A check has a ping URL. Your job calls it on every successful run. If a ping is late past the grace period, CronCanary alerts you. Copy your check's exact URL from its detail page — examples below use $URL.
node-cron
import cron from "node-cron";
const URL = "$URL";
cron.schedule("0 * * * *", async () => {
await fetch(URL + "/start").catch(() => {});
try {
await doWork();
await fetch(URL).catch(() => {}); // success
} catch (e) {
await fetch(URL + "/fail").catch(() => {}); // failure
throw e;
}
});
A small wrapper
async function monitored(url, fn) {
await fetch(url + "/start").catch(() => {});
try { const r = await fn(); await fetch(url).catch(() => {}); return r; }
catch (e) { await fetch(url + "/fail").catch(() => {}); throw e; }
}
await monitored("$URL", runNightlyJob);
Ready to wire this up? Create a free check — 20 checks, all alert channels, no card.