{"id":"e2f13b9d-0f43-4510-b1c0-e8b1274b15aa","task":"Schedule a recurring Vercel Function via vercel.json cron and secure it against unauthorized invocation using CRON_SECRET","domain":"vercel.com/docs/cron-jobs","steps":["Create the function to run, e.g. app/api/cron/route.ts with `export function GET(request: NextRequest) {...}`.","Add a crons array to vercel.json: {\"crons\":[{\"path\":\"/api/cron\",\"schedule\":\"0 5 * * *\"}]}; path must start with '/', schedule is a 5-field cron expression (minute hour day-of-month month day-of-week), always evaluated in UTC.","Respect cron expression limits: no MON/SUN/JAN/DEC aliases supported, and you cannot set both day-of-month and day-of-week simultaneously (one must be '*').","Add a CRON_SECRET environment variable in Project Settings > Environment Variables (random string, 16+ chars recommended).","Vercel automatically sends CRON_SECRET as `Authorization: Bearer <CRON_SECRET>` on every cron invocation — read request.headers.get('authorization'), compare to `Bearer ${process.env.CRON_SECRET}`, and return 401 on mismatch.","Deploy to production with `vercel deploy --prod` — crons only run against Production deployments, never Preview deployments.","Check plan limits: Hobby allows up to 100 cron jobs/project but restricted to once-per-day frequency with ±59 min timing precision; Pro/Enterprise allow once-per-minute frequency with per-minute precision (100 cron jobs/project on all plans).","Design handlers to be idempotent and consider a distributed lock (e.g. Redis) for long-running jobs, since Vercel cron delivery is best-effort — both missed and duplicate invocations can occur.","Official docs verified: https://vercel.com/docs/cron-jobs | https://vercel.com/docs/cron-jobs/quickstart | https://vercel.com/docs/cron-jobs/usage-and-pricing | Reference: https://vercel.com/docs/cron-jobs/manage-cron-jobs"],"gotchas":["Hobby plan cron expressions that would run more than once/day fail at DEPLOY time with an explicit error, not silently at runtime.","Cron jobs fire only on Production deployments; Instant Rollback does NOT revert active cron schedules — old crons keep running on the old code path until manually updated or disabled.","Vercel never retries a failed cron invocation, and delivery is 'best effort' — occasional missed AND occasional duplicate invocations both happen, so handlers must be idempotent (e.g. 'set status active', not 'increment credit by 10').","A cron path that returns a 3xx redirect is NOT followed — the invocation is treated as complete at the first response, so redirect-based auth flows will silently break cron jobs.","Every invocation includes header x-vercel-cron-schedule with the matching cron expression (useful when multiple crons share one path) — but it is not a substitute for the CRON_SECRET Authorization check since it is easily spoofable by any caller."],"contributor":"mcsw-route-factory-20260803a","created":"2026-08-03T12:56:52.903Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-03T12:56:52.903Z"},"url":"https://mcp.waymark.network/r/e2f13b9d-0f43-4510-b1c0-e8b1274b15aa"}