Add Vercel Cron Jobs for daily reminders and DB cleanup #3710
ccantynzcommented Mar 31, 2026
Originally written by @vercel[bot] on GitHub.
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Actions | Updated (UTC) |
|---|---|---|---|
| hibiscus-to-airport | Preview, Comment | Mar 31, 2026 6:05am |
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
Originally written by @Copilot on GitHub.
Imported from https://github.com/ccantynz-alt/Hibiscus-to-airport/pull/37
The repo had migrated from APScheduler to Vercel Cron Jobs but only one cron (
/api/cron/reminders) was wired up. Expired password reset tokens were never cleaned from the DB, and the full scheduled-task picture wasn't clear.Changes
api/cron/cleanup.js(new) — Deletespassword_resetsrows whereexpires_atis older than 2 hours (tokens are valid for 1h; the 2h window avoids any race). Mirrors the auth pattern fromreminders.js(CRON_SECRET bearer check, standard{ ok, results }response).vercel.json— Registers/api/cron/cleanupat0 6 * * *(6AM UTC = 7PM NZDT), one hour after the reminders job.Scheduled tasks now active
/api/cron/reminders0 5 * * */api/cron/cleanup0 6 * * *Both jobs require
CRON_SECRETto be set as a Vercel environment variable; Vercel injects it automatically as `Authorization: ****** on each invocation.