Monitor Supabase Cron and pg_cron jobs
On this page
Supabase Cron is pg_cron, and pg_cron records each run in a table nobody reads. A failed job writes a row to cron.job_run_details, not an alert. A ping at the end of the job command makes a failed or stuck job visible within minutes.
How can a scheduled job fail silently on Supabase Cron and pg_cron?
- pg_cron runs several jobs in parallel but only one instance of each job at a time. If a second run is due before the first finishes, it waits in a queue and starts when the first ends, so a slow job drifts later every time.
- pg_cron does not run any jobs while the server is in hot standby mode. It starts again when the server is promoted.
- Supabase recommends no more than 8 jobs running at once and no job running longer than 10 minutes.
- The default time zone is GMT, set with cron.timezone. A schedule written in local time is wrong until the setting matches.
- Job history lives in cron.job_run_details and grows if nobody prunes it.
What are the limits of Supabase Cron and pg_cron?
| Limit | What the documentation says |
|---|---|
| Frequency | Supabase Cron runs jobs anywhere from every second to once a year. |
| Seconds | An interval of 1 to 59 seconds is allowed, but you cannot mix seconds with the other time units. |
| Concurrency | Recommended maximum of 8 jobs at once; each job no more than 10 minutes. |
| Per-job instances | One at a time; a due second run is queued. |
| Time zone | GMT by default; cron.timezone changes it. |
| Run history | cron.job_run_details records the status of every run. |
How do you add a CronMissed ping to Supabase Cron and pg_cron?
Make the job command call the work and then send the ping. If the work raises an error, the whole command fails before the ping, so a ping means success. The second statement uses the pg_net extension on Supabase to send the request.
select cron.schedule(
'nightly-cleanup',
'15 3 * * *',
$$
select public.cleanup_old_rows();
select net.http_get(url := 'https://ping.cronmissed.com/5f0c1b2e-7a3d-4c8e-9b61-2d4f8a7e3c10');
$$
);To catch jobs that fail, read the run history once an hour and ping a second check with the result.
select count(*) filter (where status = 'failed') as failed_last_hour
from cron.job_run_details
where start_time > now() - interval '1 hour';Which check settings fit Supabase Cron and pg_cron?
Create a cron check with the same expression in GMT. A job that keeps its work short needs only a few minutes of grace; give a job near the 10 minute guidance 15. For a job that runs every few seconds, a heartbeat check is the wrong tool: watch the failed count in cron.job_run_details instead and ping once a minute from a summary job.
How do you confirm the check works?
- Run select cron.schedule for a test job every minute, wait for a run, and look at cron.job_run_details.
- Make the cleanup function raise an exception and confirm that no ping arrives and the check goes down after the grace.
- Unschedule the job with cron.unschedule and confirm the check goes late.
Sources
- Supabase Docs: Cron , read 22 October 2026
- pg_cron README , read 22 October 2026
Questions and answers
- No. pg_net sends requests asynchronously, so a slow CronMissed response cannot hold up your job. A request is queued only if the command reaches that statement, which is why it comes last.
- It tells you what ran. It cannot tell you that nothing ran, for example when the extension is stopped or the database is unreachable. The heartbeat catches both.
Does pg_net send the request inside the transaction?
Can I just check cron.job_run_details?
Create a check, add the ping to the job, and CronMissed alerts you the first time a run is late or reports a failure.
Start monitoring