Supabase · pg_cron

Monitor Supabase pg_cron Jobs

Supabase's pg_cron extension runs scheduled SQL directly inside Postgres — since there's no application code involved, monitoring means calling out to Pingtastic from SQL itself, typically via the pg_net extension.

Setup

1

Create an incoming monitor

Add a heartbeat monitor in Pingtastic matching the job's schedule.

2

Enable pg_net

Supabase ships pg_net, but it may need enabling per-project.

create extension if not exists pg_net;
3

Schedule the job with pg_cron

Call your real work and then ping via pg_net's async HTTP request, as the last statement.

select cron.schedule(
  'nightly-cleanup',
  '0 3 * * *',
  $$
  -- ...existing SQL job logic...
  select net.http_get('https://ping.pingtastic.net/ping/nightly-cleanup');
  $$
);

Gotchas

  • ⚠pg_net requests are asynchronous (fire-and-forget from SQL's perspective) — if the ping statement is placed before a later statement that fails, the ping still goes out even though the job as a whole didn't fully succeed. Put the ping as the last statement, after everything else has committed successfully.
  • ⚠pg_cron jobs run with the privileges of the database role that scheduled them — a role permission change (e.g. during a migration) can cause the job to start silently failing with no application-level error anywhere, since nothing outside Postgres is watching.

Questions

Do I need pg_net, or can I call an HTTP endpoint directly from pg_cron?

pg_cron itself only runs SQL — pg_net (or an equivalent HTTP extension) is what actually lets that SQL make an outbound HTTP call to Pingtastic's ping URL.

Can I monitor a Supabase Edge Function on a schedule instead?

Yes — an Edge Function triggered by pg_cron (via pg_net) or by Supabase's own Cron feature should ping from inside the function handler instead, the same pattern as monitoring any other serverless function.

Start monitoring your Supabase pg_cron

Set up your first monitor in under five minutes.

Get started — $5/month