Skip to content
Visit Workers on GitHub
Set theme to dark (⇧+D)

Cron Triggers

Set a Cron Trigger for your Worker.

async function triggerEvent(event) {
// Fetch some data
console.log("cron processed", event.scheduledTime);
export default {
async scheduled(event) {

Setting Cron Triggers in Wrangler

If you are deploying with Wrangler, set the cron syntax (once per hour as shown below) by adding this to your wrangler.toml file:

name = "worker"
# ...
crons = ["0 * * * *"]

You also can set a different Cron Trigger for each environment in your wrangler.toml. You need to put the [triggers] table under your chosen environment. For example:

crons = ["0 * * * *"]