Skip to content

Commit b2c24c6

Browse files
authored
docs: improve Supabase worker cron job setup instructions (#509)
# Improve Supabase Worker Monitoring Documentation This PR enhances the documentation for keeping Supabase workers running by: - Adding clear instructions for replacing all placeholders in the SQL example - Including the project reference placeholder in the URL path - Fixing the URL format to use the project reference instead of a generic "your-project" placeholder - Adding a note about creating separate cron jobs for each worker function - Highlighting code placeholders in the SQL example for better visibility These changes make the setup process more explicit and help prevent common configuration errors when implementing worker monitoring.
1 parent 0b84bb0 commit b2c24c6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

pkgs/website/src/content/docs/deploy/supabase/keep-workers-running.mdx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ This approach checks existing worker counts before spawning new ones:
2727

2828
1. **Create the safety net cron job**
2929

30-
Remember to change `<your-worker-name>` to name of your worker's Edge Function and `<YOUR_ANON_KEY>` to match your project's ANON key.
30+
Replace these placeholders with your values:
3131

32-
```sql
32+
- `<your-project-ref>` → your Supabase project reference (Dashboard → Project Settings → General → Project ID field)
33+
- `<your-worker-name>` → your Edge Function name (e.g., `my-worker`)
34+
- `<YOUR_ANON_KEY>` → your project's ANON key (from Dashboard → Settings → API)
35+
36+
```sql "<your-project-ref>" "<your-worker-name>" "<YOUR_ANON_KEY>"
3337
SELECT cron.schedule(
3438
'watchdog--<your-worker-name>',
3539
'10 seconds',
3640
$$
3741
SELECT net.http_post(
38-
url := 'https://your-project.supabase.co/functions/v1/<your-worker-name>',
42+
url := 'https://<your-project-ref>.supabase.co/functions/v1/<your-worker-name>',
3943
headers := jsonb_build_object('Authorization', 'Bearer <YOUR_ANON_KEY>')
4044
) AS request_id
4145
WHERE (
@@ -47,6 +51,10 @@ This approach checks existing worker counts before spawning new ones:
4751
);
4852
```
4953

54+
<Aside type="note" title="One Cron Per Worker">
55+
Create a separate cron job for each worker function you want to monitor. Each cron should have a unique name (e.g., `watchdog--worker-a`, `watchdog--worker-b`).
56+
</Aside>
57+
5058
</Steps>
5159

5260
## Cron Frequency Options

0 commit comments

Comments
 (0)