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 });
}- Every-minute schedules on Vercel need a plan that allows them. CronNudge’s own sweep has the same requirement.
- If doTheWork throws, the ping never happens and the check goes late after grace. Catch the error and POST /fail if you want the alert immediately.
- Keep CRONNUDGE_URL in environment variables, not in the repository.