You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
notification cron jobs should refuse to run when their Vault secrets are missing, instead of enqueuing NULL-url requests every minute #805
Follow-up to #564, where dev ran notifications-send-worker 1,440 times a day into null value in column "url" of relation "http_request_queue" because migration 337's jobs read edge_functions_url and service_role_key from Vault at execution time and nothing checks they exist.
Evidence
packages/supabase/migrations/337_notification_cron_vault.sql schedules six pg_cron jobs whose command is roughly:
With either row absent the subselect is NULL, url is NULL, and pg_net rejects the insert — one failed row per schedule tick, forever, and nothing surfaces it. The migration guards on pg_cron being installed but not on the secrets it depends on.
A second trap found on #564: the service_role_key value must match what the function runtime holds as SUPABASE_SERVICE_ROLE_KEY, which is the legacy JWT on prod and the new sb_secret_… key on dev. A wrong-but-present key fails as a 401 from the function, visible only in net._http_response.
Acceptance
A new numbered migration (337 is applied on every environment; do not edit it) wraps the six job commands in a guard: when either Vault row is missing, RAISE WARNING once and return without calling net.http_post. A small notifications.cron_target() helper returning (url, bearer) or NULL keeps the six commands identical.
The guard is exercised locally: with the two rows deleted from Vault on a local stack, a manual cron.job run produces no http_request_queue row and one warning.
docs/agents/RELEASE-PROCESS.md (or the runbook that covers key rotation) says: when a project moves to the new API keys, update its service_role_key Vault row to the sb_secret_ value, then confirm net._http_response shows 200 for the next notifications-send-worker tick.
Related: #564, #559 (same class: a migration that "succeeds" while doing something useless).
Activity
fix(notifications): scope the inbox to the active role and move cron …