Monitor Node.js scheduled jobs with HookPulse
Call the check-in URL with fetch when the job ends, and the failure URL when it throws. No package needed.
Updated
1Create the monitor
Add a routine named node-job and set how often the job runs. Its page shows the check-in URL: use it in place of https://hookpulse.net/in/YOUR_ID.
2Check in at the end of the job
Put your job in runJob. fetch is built into Node 18 and later.
// Node 18+ has fetch built in. Run as an ES module (.mjs).
const HOOKPULSE_URL = "https://hookpulse.net/in/YOUR_ID";
const checkIn = (path = "") => fetch(HOOKPULSE_URL + path, { signal: AbortSignal.timeout(10_000) });
try {
await runJob();
await checkIn();
} catch (error) {
await checkIn("/fail").catch(() => {});
throw error;
}3Run it once
Run the script once with node. The routine shows the first check-in. From then on, a missed or failed run sends the alert.