CronNudge

Vercel Cron

Vercel invokes a path on a schedule. Guard that path with CRON_SECRET, do the work, then POST the CronNudge URL.

{
  "crons": [
    { "path": "/api/jobs/digest", "schedule": "0 9 * * *" }
  ]
}

export async function GET(request: Request) {
  if (request.headers.get("authorization") !== `Bearer ${process.env.CRON_SECRET}`) {
    return new Response("Unauthorized", { status: 401 });
  }
  await doTheWork();
  await fetch(process.env.CRONNUDGE_URL!, { method: "POST" });
  return Response.json({ ok: true });
}