Developer Outlines Free Vercel Cron Job Method
A developer has published a workaround for running hourly cron jobs on a Next.js application hosted on Vercel's free tier. The solution uses the external service cron-job.org to trigger Supabase Database Functions on a schedule. This method bypasses Vercel's platform limitations, which typically require a paid plan for scheduled tasks.
- Vercel's free "Hobby" tier officially restricts its built-in cron jobs to run only once per day. For higher frequencies, such as hourly, an upgrade to a paid "Pro" plan is required, which starts at $20 per user per month. - The workaround leverages cron-job.org, a free external service that can make HTTP requests to a specified URL on a schedule as frequent as every minute. This service effectively acts as the trigger that Vercel's free plan lacks for high-frequency tasks. - The free service cron-job.org has limitations; it will time out if the triggered script runs for more than 30 seconds or returns more than 1024 bytes of data. The service also disables jobs after 15 consecutive failures. - Supabase's role in this solution is to host the function that performs the actual task. Supabase Functions can be triggered by a webhook, which is what cron-job.org calls. Supabase itself offers a cron scheduler based on `pg_cron` for Postgres, allowing users to schedule functions directly within the platform. - This method introduces additional points of failure and complexity compared to native Vercel cron jobs. The developer is now responsible for managing the integration and monitoring of three separate services: Vercel, cron-job.org, and Supabase. - Alternative platforms to Vercel, such as Netlify, Cloudflare Pages, and Render, offer their own solutions for scheduled functions and background jobs, some of which may be more generous on their free tiers. For example, Cloudflare Pages has a notable free tier for its Workers. - Other external services that provide cron job functionality similar to cron-job.org include QStash and Inngest, which also offer free tiers and can be used to trigger endpoints on a Vercel-hosted application.