Yesterday Vercel announced that Cron Jobs are now configurable on their platform. It’s a nice addition to say the least. However, isn’t it rather late to add a feature like this? Since the initial release of Cron Jobs in Unix already date back from early 1975. Of course, I forgo that on the Vercel Platform you don’t have to manage any infrastructure. And certainly you don’t have to configure a server yourself. So the Cron Jobs feature is still welcome.

TL;DR; It’s a nice additional feature, especially that you can configure your jobs as code. However the limits imposed on hobby plans are disproportionate.

How to use Vercel Cron Jobs?

In order to get started using Vercel Cron Jobs you have to modify the vercel.json file in your project. In this file you will configure when and what job you want to trigger. For example:

The crons property holds a list of job definitions. Each definition defines what function to trigger relative to the apps root domain in the path property. The path property is required to start with /. When this function should trigger is defined by the cron notation in the schedule property. To learn more on cron notation take a look at crontab.

Additionally Vercel mentions that Cron Jobs are only invoked on the production slot of the app. So any preview deployments won’t have their functions invoked for the jobs defined.

Actually I have already been using cron jobs for automating tasks. In one application I’ve had the need to send out notifications. My function looks up any upcoming events for the next day. If one or more events are found then a push notification is send out to the users that have subscribed. This happens on a daily basis. I’ve implemented that by using GitHub actions.

What is the catch with Vercel’s Cron Jobs offering?

According to their docs, this feature has the following limitations per plan:

  • Hobby: 2 cron jobs [max], maximum of 1 invocation per day.
  • Pro: 40 cron jobs, unlimited invocations per day.
  • Enterprise: 100 cron jobs, unlimited invocations per day.

Besides these limitations on cron jobs, regular limitations on the functions invoked apply. So for example a function in the Hobby plan will not run longer than 10s (or 30s if you’ve deployed to the edge) before being terminated. You can find all limits imposed here.

Furthermore while Cron Jobs are in beta Vercel mentions:

While in beta, Vercel Cron Jobs are free on all plans. However, it’ll be a paid feature for general availability.

In someway it’s not unexpected this will be a paid feature. Looking at the alternative providers that Vercel mentions in their setup guide. Many of those have paid plans and have poor hobby offerings. And none of those allow you to configure your cron jobs as code. Which you are able to do with vercel.json.

What is a potential alternative for hobbyists?

If you fancy configuring your cron jobs as code and you don’t want to pay an arm and a leg then I have just the alternative to consider. Like I mentioned before, I was already using cron jobs before Vercel released this beta feature. I use GitHub actions to invoke my service.

Of course, GitHub also sets limits, but those are way more generous than Vercel provides. For example, with GitHub actions I’m able to trigger an action every 5 minutes. That’s perhaps more restrictive than the pro and enterprise plans on Vercel, but way more than the hobby plans offers. Keep I mind that I run this from a free/hobby plan on GitHub.

How to configure Cron Job functions from GitHub you ask? Well you just define a workflow file with a Cron trigger. In this workflow you will run the curl command on your api endpoint!

As you can see, you can configure your jobs just as easy. If you have more functions that should run on the same cron interval, you can just add more steps that run curl. If you need a different interval, then just add more workflow files. Read the workflow documentation for more information.

Wrap up

It’s nice to see that Vercel keeps on improving their serverless offerings. But with the limitations imposed on the Hobby plan we can see that Vercel starts to monetise their services more and more. Hopefully they will keep their solid core offerings for hobbyists.

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *