Netlify doesn’t support traditional cron jobs out of the box, but you can still schedule background tasks without spending a cent. This article shows how to create scheduled tasks in a Netlify serverless environment using GitHub Actions or third-party schedulers — keeping everything lean, free, and scalable.

Why Use Cron Jobs on Netlify?

Use cases include:

  • Sending daily digest emails
  • Database maintenance tasks
  • API polling or caching routines

Step 1: Set Up a Netlify Function

First, create a serverless function in the netlify/functions directory:

// netlify/functions/scheduled-task.js
exports.handler = async function () {
  console.log("Scheduled function ran");
  return {
    statusCode: 200,
    body: JSON.stringify({ message: "Task complete" }),
  };
};

Step 2: Trigger It With GitHub Actions

This approach requires no changes to Netlify and is totally free if you already use GitHub:

# .github/workflows/netlify-cron.yml
name: Trigger Netlify Scheduled Task

on:
  schedule:
    - cron: '0 */1 * * *' # every hour

jobs:
  run-task:
    runs-on: ubuntu-latest
    steps:
      - name: Call Netlify function
        run: curl https://your-netlify-site.netlify.app/.netlify/functions/scheduled-task

Optional: Use an External Scheduler

Platforms like Upstash Scheduler or cron-job.org can also be used to ping your function URL on a schedule. These are free and require no code changes.

Pros and Cons

✅ Pros

  • Zero infrastructure overhead
  • Free usage tier with GitHub or Upstash
  • Flexible intervals and decoupled logic

⚠️ Cons

  • Relies on external HTTP triggers
  • May face latency if you're expecting exact timing

🚀 Alternatives

  • Netlify Scheduled Functions: Only available on paid plans
  • Trigger.dev: Self-hosted alternative with precise scheduling and queues

Conclusion

With a simple API function and a scheduled ping, you can build serverless cron jobs in Netlify without any costs. Whether it’s weekly reports, cleanup tasks, or automation workflows, this solution is powerful and developer-friendly.

If you found this useful, you can support me here: buymeacoffee.com/hexshift