We’re delighted to announce that Simon Knott, creator of Quirrel and maintainer of Blitz.js, is joining the Netlify family.
Quirrel is an open source solution and service for managing and scheduling the execution of serverless functions and jobs. Beyond Quirrel, Simon is also a maintainer for Blitz.js, a fullstack JavaScript framework that brings “Zero API” backend functionality to Next.js, and creator of SuperJSON, a library that helps serialize JavaScript types to JSON.
In 2018, we embarked on a mission to bring serverless functions to the Jamstack without sacrificing the simplicity, collaboration, and performance that you’ve come to expect from Netlify. As we evolve Netlify Functions, we expect Simon’s expertise in the open source and serverless space to support the team at Netlify in continuing innovations around executing external APIs, scheduling functions, and more.
Introducing Scheduled Functions
As part of this innovation, and inspired in large part by Quirrel, we’re excited about our latest experiment to bring scheduling to Netlify Functions. Beginning today, we invite you to try our Scheduled Functions as part of Netlify Labs.
Scheduled Functions is a feature of Netlify Functions that enables you to run functions on a regular and consistent schedule, much like a cron job. Scheduled functions can do anything that serverless functions do today, though some tasks are better suited to scheduled functions than others.
For example, you may want to:
-
Invoke a set of APIs to collate data for a report at the end of every week
-
Back up data from one data store to another at the end of every night
-
Build and deploy all your static content every hour instead of for every authored or merged pull request, or
-
Anything else you can imagine you might want to invoke on a regular basis!
However, Scheduled Functions are not intended for any kind of server-side rendering (SSR) and therefore cannot be invoked directly by calling a URL.
After opting into the feature in Labs, it’s easy to turn a regular function into a scheduled function. This one will run daily at midnight UTC:
my-site-repo/netlify/functions/test-scheduled-function.js
const { schedule } = require('@netlify/functions')
const handler = async function(event, context) {
console.log("Received event:", event)
return {
statusCode: 200,
};
};
module.exports.handler = schedule("@daily", handler);
You can learn more about how Scheduled Functions work by hopping over to the Netlify docs for more detailed documentation. We also welcome any and all feedback on how Scheduled Functions are working for you, or what you’d like to see from functions going forward, on the Netlify forums or in the Netlify Functions repo Issues. Going forward, we’ll be using your feedback to drive changes and future plans.
And of course, stay tuned for more innovations from Simon and the rest of the Netlify team.