The FW-59 edge functionDocumentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
fw-webhook-maintenance handles log retention purging and expired secret deactivation.
Prerequisites
Enable extensions in the Supabase Dashboard → Extensions:pg_cronpg_net
util.invoke_edge_function is available and app.settings.service_role_key is configured in Vault.
Scheduling SQL
Run this in the Supabase SQL Editor (NOT as a migration — it uses project-specific Vault settings):Verification
Managing the Cron Job
What It Does
| Task | Schedule | Description |
|---|---|---|
| Log retention purge | Daily 2 AM UTC | Deletes fw_webhook_logs rows older than 90 days (paginated, 1000 per batch) |
| Expired secret deactivation | Daily 2 AM UTC | Sets is_active = false on fw_webhook_secrets where expires_at < now() |
Troubleshooting
| Symptom | Check |
|---|---|
| Job not running | SELECT * FROM cron.job WHERE jobname = 'fw-webhook-maintenance'; — is it registered? |
| Logs not being purged | Check Edge Function logs for errors. Verify fw_webhook_logs has rows older than 90 days. |
| Secrets not deactivated | Verify secrets have expires_at set and it’s in the past. |
| Edge function errors | Check Edge Function logs in Supabase Dashboard. |
Related Docs
- FW-46 Cron Scheduling — similar pattern reference
- FW-59 Spec
- FW-59 Integration Doc