CronNudge

Node.js

Read CRONNUDGE_URL from the environment. Ping start, run the work, and ping fail with a short error string if it throws.

const url = process.env.CRONNUDGE_URL;
if (!url) throw new Error("CRONNUDGE_URL is not set");

await fetch(url + "/start", { method: "POST" });
try {
  await run();
  await fetch(url, { method: "POST" });
} catch (error) {
  await fetch(url + "/fail", {
    method: "POST",
    headers: { "content-type": "application/json" },
    body: JSON.stringify({ exit: 1, error: String(error).slice(0, 500) }),
  });
  throw error;
}

Longer guide: EventBridge scheduled Lambda · BullMQ, node-cron, and Agenda · Cloud Scheduler and Cloud Run