Cron jobs
Invoke a Function on a schedule by adding a schedule expression to its entry in gigadrive.yaml.
A Function can be invoked on a schedule without any client calling it, by adding schedule to its entry in gigadrive.yaml. Gigadrive Network then sends it a request on the cadence you declare.
Declaring a schedule
version: 4
functions:
api/cleanup.js:
runtime: node-22
memory: 256
max_duration: 300
schedule: rate(1 hour)
routes:
- source: ^/cleanup$
destination: /api/cleanup.jsThe config file accepts two forms:
| Form | Example |
|---|---|
| A fixed interval | rate(1 hour), rate(5 minutes), rate(2 days) |
| A six field cron expression | cron(0 12 * * ? *) |
Three rules decide whether a schedule is registered at all:
- One schedule per Function. Redeploying replaces it rather than adding a second.
- The Function needs a public route. The schedule targets the Function's
/route when it declares one, otherwise its first declared route. A Function reachable at no path is skipped silently. scheduledoes not inherit across patterns. When twofunctionspatterns match the same file, scalar settings such asmemorymerge with the later one winning, butscheduleis read only from the pattern that first produced the Function. Declare it on the pattern that owns the file, never on a broad glob you expect to be overridden.
Intervals
A rate(...) interval counts from the top of the hour or the start of the UTC day, not from the moment you deployed. rate(1 hour) runs at minute 0 of every hour, rate(15 minutes) runs at minutes 0, 15, 30 and 45, and rate(1 day) runs at midnight UTC.
An interval in minutes must be below 60 or a whole number of hours, and an interval in hours must be below 24 or a whole number of days. An interval that does not divide its hour, day or month evenly starts again at each boundary: rate(7 minutes) runs at minute 0, 7, and so on up to 56, then again at minute 0, and rate(2 days) runs on the 1st, 3rd, 5th and so on of each month. An interval longer than 31 days is not supported.
Cron expressions
A cron(...) expression has six fields: minutes, hours, day of month, month, day of week and year. Every field is evaluated in UTC.
- Day of week counts Sunday as
1and Saturday as7, or takes the namesSUNtoSAT.cron(15 10 ? * MON-FRI *)runs at 10:15 UTC on weekdays. ?means any value. Use it in day of month or day of week, whichever you are not restricting.- Months take numbers or the names
JANtoDEC. - The year field must be
*.
The config file also accepts L (last), W (nearest weekday), # (the nth weekday of a month) and a fixed year. Gigadrive Network does not run a schedule that uses any of them: the deployment succeeds, but the Function is never called on that schedule. The same applies to a rate(...) interval outside the limits above.
What the platform sends
The request goes to the deployment's own hostname at the Function's route path, over the public edge. It takes the same path a browser request takes, which means routing, waking a Function that has scaled to zero, logging and billing all behave identically.
- The method is
GET, and no body is sent. Neither is configurable. - Your Function receives
x-nebula-cron: true. No client on the internet can set that header, so you can trust it to tell a scheduled invocation apart from ordinary traffic. - The request is abandoned if your Function has not responded within 30 seconds.
What is not guaranteed
Schedules are evaluated once a minute in UTC. A schedule cannot run more often than that, and the exact second within the matching minute is not fixed.
Delivery is judged by the response status. Only a 2xx counts as delivered. A failed call, including a non-2xx response, a timeout or a connection failure, is not retried later: the schedule matches a single minute, so the next call is the next matching minute. Record failures yourself if a missed run matters.
Exactly-once delivery is not offered. Make the endpoint idempotent, and do not use the request itself to carry state.
