🚧 This documentation is not complete yet as Lagon is in Alpha.
Cloud
Cron

Instead of providing an HTTP endpoint, you can create a Cron expression (opens in a new tab) to automatically execute your Function at the given intervals.

How it works

Cron Functions work the same as normal Functions, except that:

  • Function's Request is always empty, meaning the body, URL, and headers are empty
  • If the Function's Response returns a 200 status code, Lagon will log a success message, optionally logging the body if it isn't empty.
  • If the Function's Response returns a non-200 status code, Lagon will log an error message optionally logging the body if it isn't empty, and retry the execution later.

Additionally, Cron Functions aren't accessible via HTTP, either using the default URL or a custom domain. As such, only the production deployment is triggered by your Cron expression.

Configuration

Head over to the settings tab of your Function in the Dashboard (opens in a new tab) and scroll to the Cron section. Here, you can configure the Cron expression, which will be empty by default. We recommend using a tool like Crontab Guru (opens in a new tab) to generate Cron expression:

Cron

In the above example, Lagon will execute your Function every day at midnight (0 12 * * *). You can then click "Update" and your Function will be automatically executed at the given intervals.

Cron Functions only run in a single region. You can select your preferred region:

Cron region

Disabling

To disable the Cron configuration, simply delete the expression and click "Update".