β Vercel Cron Jobs - Verification Checklist
π― Quick Answer to Your Questionsβ
Question 1: Does it work on Vercel without Trigger.dev?β
β YES - The system is correctly configured to use Vercel Crons when:
VERCEL=1(automatically set by Vercel)- Trigger.dev env vars are NOT set
Question 2: How to verify it's working?β
β Follow the 4 steps below
π Current Configuration Statusβ
β What Was Fixedβ
| Component | Status | Details |
|---|---|---|
vercel.json | β FIXED | Now includes all 3 cron jobs (was only 1) |
initialize-jobs.ts | β FIXED | Now registers all 3 jobs (was only 2) |
| API endpoints | β OK | All 3 endpoints exist and work |
| Documentation | β CREATED | New CRON_JOBS.md guide |
π Complete Cron Jobs Listβ
| # | Job Name | Endpoint | Schedule | Purpose |
|---|---|---|---|---|
| 1 | Repository Sync | /api/cron/sync | */5 * * * * | Syncs content every 5 minutes |
| 2 | Renewal Reminders | /api/cron/subscription-reminders | 0 9 * * * | Sends reminder emails at 9 AM daily |
| 3 | Expiration Cleanup | /api/cron/subscription-expiration | 0 0 * * * | Processes expired subscriptions at midnight |
π 4-Step Verification Processβ
Step 1: Check Vercel Dashboard - Cron Jobsβ
URL Template:
https://vercel.com/{TEAM}/{PROJECT}/settings/cron-jobs
For awesome-time-tracking-website:
https://vercel.com/ever-works/awesome-time-tracking-website/settings/cron-jobs
What to Look For:
- Shows 3 cron jobs (not just 1)
- Each has correct schedule
- All show status "Active"
Expected Result:
| Path | Schedule | Status |
|---|---|---|
/api/cron/sync | Every 5 minutes | β Active |
/api/cron/subscription-reminders | 0 9 * * * | β Active |
/api/cron/subscription-expiration | 0 0 * * * | β Active |
Step 2: Check Vercel Logsβ
URL Template:
https://vercel.com/{TEAM}/{PROJECT}/logs?requestPaths={PATH}
Check each endpoint:
A. Sync Logsβ
https://vercel.com/ever-works/awesome-time-tracking-website/logs?requestPaths=%2Fapi%2Fcron%2Fsync
- Logs appear every 5 minutes
- Status codes are 200 (success)
- No 401 errors (auth)
- No 500 errors (crashes)
B. Reminder Logsβ
https://vercel.com/ever-works/awesome-time-tracking-website/logs?requestPaths=%2Fapi%2Fcron%2Fsubscription-reminders
- Logs appear once daily at 9:00 AM
- Status codes are 200 or 207 (success/partial success)
C. Expiration Logsβ
https://vercel.com/ever-works/awesome-time-tracking-website/logs?requestPaths=%2Fapi%2Fcron%2Fsubscription-expiration
- Logs appear once daily at midnight
- Status codes are 200 (success)
Step 3: Check Application Logsβ
Look for these log messages:
On Application Startupβ
[BackgroundJobs] Vercel cron mode - jobs handled by /api/cron/sync endpoint
β This confirms: System detected Vercel environment
On Each Sync (every 5 min)β
[CRON_SYNC] Vercel cron sync triggered
[CRON_SYNC] Completed in XXXms: Repository synced successfully
On Renewal Reminders (daily 9 AM)β
[Cron] Subscription reminders job completed
On Expiration Cleanup (daily midnight)β
[SubscriptionExpiration] Starting expired subscription processing...
[SubscriptionExpiration] Completed: N subscriptions expired
Step 4: Check Environment Variablesβ
Required:
CRON_SECRET=<set-in-vercel>
NOT set (to use Vercel, not Trigger.dev):
TRIGGER_SECRET_KEY=<should-be-empty>
TRIGGER_API_KEY=<should-be-empty>
TRIGGER_API_URL=<should-be-empty>
Check via Vercel CLI:
vercel env ls
Check via Dashboard:
https://vercel.com/ever-works/awesome-time-tracking-website/settings/environment-variables
π¨ Common Issues & Solutionsβ
Issue 1: Only seeing 1 cron job in Vercelβ
Cause: Old vercel.json was deployed
Solution:
- β
vercel.jsonis now fixed (3 crons) - Redeploy to Vercel:
git pushorvercel --prod - Wait 1-2 minutes for Vercel to register new crons
Issue 2: 401 Unauthorized errorsβ
Cause: CRON_SECRET not set or mismatch
Solution:
# Generate a new secret
openssl rand -base64 32
# Add to Vercel
vercel env add CRON_SECRET
# Redeploy
vercel --prod
Issue 3: Jobs not running at allβ
Cause: Using Trigger.dev mode instead of Vercel mode
Check:
# Should NOT be set
vercel env ls | grep TRIGGER
Fix:
# Remove Trigger.dev vars
vercel env rm TRIGGER_SECRET_KEY production
vercel env rm TRIGGER_API_KEY production
vercel env rm TRIGGER_API_URL production
# Redeploy
vercel --prod
Issue 4: Logs show "LocalJobManager" instead of "Vercel cron mode"β
Cause: Not running on Vercel (probably localhost)
This is OK if:
- Running
pnpm devlocally - Testing on localhost
This is a PROBLEM if:
- Running on Vercel production
- Env var
VERCEL=1is not set
Fix:
- Vercel sets
VERCEL=1automatically - If missing, check deployment logs
π Expected Behaviorβ
On Vercel Productionβ
Scheduling: Handled by Vercel (not by Node.js)
Execution: Direct HTTP calls from Vercel to API routes
Authentication: CRON_SECRET via Authorization header
On Localhost (Development)β
Scheduling: Handled by LocalJobManager (in-process)
Execution: Direct function calls
Authentication: Not required
π Next Stepsβ
Immediate Actionsβ
-
Deploy the changes:
git add vercel.json lib/background-jobs/initialize-jobs.ts
git commit -m "fix: add missing cron jobs to vercel.json"
git push -
Wait 2-3 minutes for Vercel to deploy
-
Verify using Steps 1-4 above
After Deploymentβ
-
Monitor for 24 hours:
- Check logs every few hours
- Verify all 3 jobs are running
- Look for any errors
-
Set up alerts (optional):
- Vercel Monitoring β Alerts
- Alert on 4XX/5XX errors
- Alert on duration > 30s