Skip to content

The entire notification pipeline is undeployed in production #436

Closed

Description

@thinkclay

Found while wiring up Resend (#431). Setting a mail API key does not make notification email work, because nothing that sends it is deployed.

Evidence

The repo defines 26 edge functions. Production runs 6:

trpc, job-import, news, news-import, email-inbound-parse, api

notify-send-worker is the only function that calls getAdapter(channel).send(...) — i.e. the only thing that actually dispatches a notification to email, push or SMS. It is not deployed. Neither is anything else in the chain:

Function Deployed Role
notify-send-worker ❌ drains core.notification_deliveries and sends
notify-publish ❌ fans a notification out to channels
notify-digest-daily / notify-digest-weekly ❌ digest email
notify-background-check-expiration ❌ 30/7-day reminders
notify-id-verification-expiration ❌ expiry reminders
notify-check-receipts ❌ receipts
send-team-invitation ❌ invitation email
webhooks (incl. webhooks/email) ❌ delivery status callbacks

Consistent with the data: core.notification_deliveries in production is completely empty — zero rows, no statuses, no history. Nothing has ever been queued or sent.

The deployed api function's notifications route only reads and writes notification rows; it never dispatches.

Why it looked like a key problem

SENDGRID_API_KEY was missing, which is true and was the visible symptom. But even with a key set, production would still send nothing, because the sender is absent. The missing key was masking a much larger gap.

What this means for #431

Setting RESEND_API_KEY on the Supabase project is correct and harmless, but it only pre-positions the credential. The thing it actually unblocks today is the marketing contact form, which runs on EAS Hosting and does not touch Supabase at all.

Fix

Decide which of these functions should exist in production, then deploy them (scripts/deploy-functions.sh handles the mechanics). notify-send-worker needs a schedule or a queue trigger to drain deliveries — worth confirming how it is meant to be invoked before deploying it, since a worker nothing calls is no better than a worker that is absent.

Also worth checking whether the same gap exists on the dev and preview Supabase projects (pmtdqrfpumqwkdhpgwcz, uhjkipdwayqfihkanabk) — neither is visible to the Supabase login on this machine, which is its own problem.

Activity

  1. added
    bug
    on Jul 29, 2026
  2. thinkclay commented on Jul 30, 2026

    @thinkclay
    ContributorAuthor

    Pipeline deployed and verified working in production — d9099a80e. One seed command remains before it runs unattended.

    Deployed (12 functions now, was 6): the seven notify-* functions, send-team-invitation, and webhooks-email (a wrapper slug for the nested webhooks/email handler).

    Why it had never worked, beyond just not being deployed:

    • Every pipeline function used extensionless Deno imports (std and relative) — they had never survived a bundler. Fixed repo-wide.
    • Migration 025 scheduled its cron jobs from settings (supabase.external_url, app.service_role_key) that don't exist on hosted projects, so it silently scheduled nothing.
    • notify-publish had no auth check behind verify_jwt=false — an open endpoint that would email arbitrary content to any user. All seven functions now require the service role key as Bearer (constant-time compare, fail closed). Verified: no-auth, anon-key-as-bearer, and unsigned-webhook probes all 401.

    Scheduling (migration 337, applied to prod): six pg_cron jobs — send-worker every minute, receipts /15, daily+weekly digests, both expiration scanners. Jobs read the functions URL and service key from Vault at run time, so the job text carries no secret and rotation is a one-row update.

    End-to-end proof: inserted a queued email delivery (the first row core.notification_deliveries has ever held), invoked the worker → {"processed":1,"results":[{"id":1,"status":"sent"}]} → row has provider_msg_id, message reached delivered in Resend from [email protected].

    Cron is firing every minute and currently 401s by design — the Vault service_role_key secret isn't seeded (the URL half already is). Remaining step:

    ./scripts/seed-notify-cron-vault.sh prod

    After that, cron-driven runs go 200 and the pipeline is fully autonomous. Optional follow-ups: seed dev/preview the same way, and set RESEND_WEBHOOK_SECRET (webhook endpoint now live at .../functions/v1/webhooks-email) so delivery statuses flow back.

  3. thinkclay commented on Jul 30, 2026

    @thinkclay
    ContributorAuthor

    Fully autonomous and verified. After the Vault seed:

    • cron tick at 01:34 returned 200 {"ok":true,"processed":0} (was 401 by design pre-seed)
    • zero-touch test: enqueued a delivery and did not invoke anything — the next minute tick drained it: status=sent, attempts=1, provider id stored, and the message reached delivered in Resend from [email protected]

    The pipeline runs itself: pg_cron → notify-send-worker → Resend, with receipts, digests and expiration scanners on their own schedules. Closing.

    Follow-ups tracked elsewhere / optional:

    • seed dev/preview Vault the same way (./scripts/seed-notify-cron-vault.sh dev|preview) once those projects are accessible
    • RESEND_WEBHOOK_SECRET for delivery-status callbacks (endpoint live at .../functions/v1/webhooks-email, fails closed until then)
    • the remaining undeployed functions (auth-, stripe-webhook, persona-webhook, community-, ccpa-deadline-check, inbound-conversation-email) were out of scope here — worth a deliberate pass on which should exist in prod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions