Skip to content

DevOps

Netlify Scheduled Functions: Cron Jobs Without a Server

Run background tasks without a cron service

⏲️
If you've been living under a rock, serverless functions are great — but they were designed for request-response workflows. You deploy a function, it waits for an HTTP call, it runs, it returns data. What about tasks that need to run on a schedule? Email digests, cache invalidation, data cleanup, webhook retries? Traditionally you'd spin up a cron service (or a whole server) just to trigger functions every hour. Netlify scheduled functions fix this. They're serverless functions that run on a cron schedule you define, no infrastructure overhead. Here's the shape. Create a function file with a specific naming convention: ```javascript // netlify/functions/send-daily-digest.mjs // This runs every day at 9am UTC export default async (req, context) => { // Your code here const users = await db.query('SELECT * FROM users WHERE active = true'); for (const user of users) { await sendEmail(user.email, generateDigest(user)); } return new Response('Sent digests to ' + users.length + ' users'); }; export const config = { schedule: '0 9 * * *' }; ``` That schedule field is a standard cron expression. 0 9 * * * means "9am UTC every day". Five fields: minute, hour, day-of-month, month, day-of-week. Netlify validates it at build time, so typos fail loudly. The difference from a regular function: scheduled functions don't need HTTP triggers. You deploy once, Netlify's infrastructure picks up the cron config, and your function runs automatically on that schedule. No third-party cron service. No server to manage. No overpaying for infrastructure you only use once a day. This is perfect for the jobs that live between your main app and a full microservice. Data syncs, cleanup, report generation, notification batches. We use it for things like cache warming, expired-session pruning, and alerting on data anomalies. It's the tool that made us stop reaching for external cron services (and stop paying for them). The catch: scheduled functions have a timeout limit (10 minutes on the Netlify free tier, 15 minutes on paid plans). If your job takes longer, you either need to break it into smaller chunks or reconsider the approach. Also, you don't get real-time observability by default — you need to wire up logging explicitly if you want to debug failures. The verdict: this is one of those features that sounds small but changes how you think about deploying apps. You no longer need a separate "cron layer". Your functions are your functions, some happen to run on a schedule. Simpler architecture, fewer moving parts, one bill instead of two. Behold: serverless but actually useful for background work.

Let us make some quick suggestions?

Please provide your full name.
Please provide your phone number.
Please provide a valid phone number.
Please provide your email address.
Please provide a valid email address.
Please provide your brand name or website.
Please provide your brand name or website.