Enable Cron Jobs
Add a Cron Job
Function path
The route or function to trigger. Examples:Your function should respond to a GET or POST — the scheduler calls it.
Schedule
Pick a preset (Every minute, Every hour, Daily at midnight) or enter a custom cron expression. See Schedule Expressions below.
Description (optional)
A note so future-you knows what this job does. “Daily revenue report to finance Slack” is better than nothing.
Schedule Expressions
All times are UTC. Do the math for your timezone.Cron Syntax
| Expression | Runs |
|---|---|
cron(0 9 * * ? *) | 9:00 AM daily |
cron(0 */2 * * ? *) | Every 2 hours |
cron(0 9 ? * MON-FRI *) | 9 AM weekdays |
cron(*/15 * * * ? *) | Every 15 minutes |
cron(0 0 1 * ? *) | Midnight on the 1st of every month |
Rate Syntax
For simple intervals, userate():
Use
? in either the day-of-month or day-of-week field, not both. cron(0 9 * * ? *) is valid; cron(0 9 * * * *) is not.Alternative: @schedule Comment
Instead of creating a job in the UI, you can mark a function with an @schedule comment and Hiveku auto-detects it.
Testing a Job
Run Now Button
Every job has a Run Now button in the Cron Jobs list. Click it to trigger the function immediately, as if the schedule just fired.Execution History
Below each job you’ll see recent runs with:- Timestamp
- Duration
- HTTP status
- Any errors returned
Pausing and Deleting
- Pause
- Resume
- Delete
Click the Pause toggle on a job to stop it from running without deleting it. Useful during maintenance.
Limits to Know
- Timeout: each cron execution runs as a serverless function with a 15-minute max runtime. For longer jobs, break the work into chunks or offload to a queue.
- Concurrency: if a run is still going when the next scheduled fire hits, the new fire is skipped (not queued up).
- Precision: scheduler accuracy is within a few seconds — don’t rely on cron for sub-second timing.
Verifying a New Cron Job
Check execution history
A new entry should appear within seconds with status 200 (or your function’s success code).
Check your function's output
Whatever side effect the job does (email sent, row inserted, log written) should have happened. Confirm in the relevant system.
Troubleshooting
Job didn't run at the scheduled time
Job didn't run at the scheduled time
Three common causes:
- Cron Jobs toggle is off — confirm it’s enabled at the top of the page
- Timezone math is wrong — schedules are UTC;
cron(0 9 ...)is 9 AM UTC, which might be 2 AM or 5 PM your time - Environment mismatch — a job set to Production-only won’t run in Staging
Job shows errors in history
Job shows errors in history
Click the failed run and check the logs. Common issues: missing env var, timeout on a slow API call, unhandled exception. Open Hosting > Logs for the full function log around that timestamp.
Function times out at 15 minutes
Function times out at 15 minutes
That’s the hard limit on serverless runtime. Split the work: have the cron fire a short function that enqueues tasks to a queue (SQS, or a DB table your app polls), then process them in smaller chunks.
My @schedule comment isn't registering
My @schedule comment isn't registering
Make sure:
- The comment is on the same line or immediately above the exported handler
- The syntax is exactly
// @schedule cron(...)or// @schedule rate(...) - You’ve redeployed since adding the comment
Two runs overlap and break each other
Two runs overlap and break each other
If your function can take longer than the schedule interval, guard it with a lock. Use a DB row, Redis, or even a simple file check — bail early if the previous run is still in progress.
What’s Next?
Environment Variables
Config secrets your jobs need
Deploy your site
Ship your cron functions