Today I learned
Vercel Cron Jobs
Vercel released Cron Jobs Opens in new tab recently! That is pretty cool. It's a feature a lot of people longed for because something like this was not available yet when using serverless environment like Vercel.
Now you can automate repetetive tasks without having a backend. To get started
with Cron Jobs in Vercel you have to create a vercel.json
file. Here are some
example Cron Jobs:
{
"crons": [
{
"path": "/api/backup",
"schedule": "0 0 * * *"
},
{
"path": "/api/weekly-mail",
"schedule": "0 0 * * 1"
}
]
}
Cron Jobs use a specific syntax to determine the time when the job should be executed. The schedule string consists of five fields separated by spaces. They stand for minute, hour, day, month and day of the week.
So the first job in the example above will be executed every day at midnight. While the second job will be executed every Monday at midnight.
With the Hobby plan you get two Cron Jobs for free which each can be triggered once per day, while the Pro plan offers 40 Cron Jobs in total with unlimited usage per day.
Here's the full documentation of Cron Jobs in Vercel: Cron Jobs Opens in new tab
I hope you enjoyed this post and learned something new. If you have any questions, feel free to reach out to me via Email Opens in new tab.
If you want to support me, you can buy me a coffee. I would be very happy about it!
☕️ Buy me a coffee ☕️I wish you a wonderful day! Marco