CronCanary DocsPricingOpen app
← Integration guides

Monitor a Node.js job

Native fetch (Node 18+) — works with node-cron, Agenda, BullMQ, or a bare interval.

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.