Troubleshooting Vercel Cron Jobs

Learn how to troubleshoot cron jobs that aren't being run or logged when using Vercel Cron Jobs.
Last updated on November 18, 2024
Build, Deployment & Git

Cron jobs are automated tasks that run at specified intervals. Vercel Cron Jobs specifically are designed to work within the Vercel ecosystem, and allow you to schedule automated tasks to run at specified intervals on Vercel.

  • Cron jobs will still execute even for paths that don’t exist, but a 404 will be returned.
  • New deployments do not affect existing cron jobs.
  • The timeout duration of cron jobs are identical to that of Serverless and Edge functions. If you're hitting these limits, consider splitting your cron jobs into smaller batches.

Ensure you're within the cron job limits for your plan. Refer to Usage & Pricing for Cron Jobs.

Cron jobs only run on Production deployments. Make sure you're not trying to run them on a preview deployment.

Attack Challenge Mode will prevent cron jobs from being run. Verify that Attack Challenge Mode was not enabled when your cron job was run, and that Attack Challenge Mode is not actively enabled for your project: https://vercel.com/docs/security/attack-challenge-mode#enabling-attack-challenge-mode

Double-check that your cron job expression matches your intended schedule. You can use our cron expression validator to ensure it's correct.

If you're not seeing logs for your cron job, it might be due to caching. To prevent this, add export const dynamic = 'force-dynamic'; to your cron job's route handler. This ensures the function runs every time, rather than serving a cached response. Refer to the Cron Jobs Quickstart guide for further examples.

If you're using custom WAF rules, they might inadvertently block your cron job, especially if it's making requests to external services. Review your WAF configuration to ensure it's not blocking your cron job.

Make sure the function name or route in your cron job configuration matches what's in your project's Deployment Summary. If you've changed the function name or route since setting up the cron job, update your cron job settings accordingly.

Couldn't find the guide you need?