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
Production sends no email: SENDGRID_API_KEY is not set #431
packages/supabase/functions/_shared/notifications/adapters/email.ts returns error: 'SENDGRID_API_KEY environment variable is not set' and sends nothing. Every email channel notification is silently dropped in production — background check status and expiry reminders, ID verification, community notifications, team invitations. The new contact form on the marketing page returns 503 for the same reason.
This was found while migrating the contact endpoint off Resend (#430); it is not caused by that change, which only made an existing gap visible.
Fix
Set the key on the edge functions:
supabase secrets set SENDGRID_API_KEY=... --project-ref qmfmpcyxsihhfttvqpbw
Set the same key in the EAS Hosting production environment, which is where the contact endpoint runs — the two are separate runtimes and do not share secrets.
Add SendGrid to SPF at the same time.scaffald.com currently publishes v=spf1 include:_spf.google.com ~all, which authorizes Google Workspace only. Mail sent from [email protected] through SendGrid will softfail SPF and land in spam. The record needs include:sendgrid.net.
Verify the [email protected] sender is verified on the SendGrid account.
Do steps 1 and 3 together — turning on sending without the SPF include trains recipients to treat our mail as spam, which is harder to undo than it is to avoid.
Then
Once the sender list is known to be complete (Google Workspace + SendGrid), SPF can be tightened from ~all back to -all. It was loosened deliberately on 2026-07-28 on Google Workspace's advice, because -all with an incomplete list was hard-failing legitimate mail.
Resolved by moving all outbound mail to Resend rather than funding SendGrid — 83c7a33f6.
Done:
scaffald.com claimed and verified in the unicorn Resend team, us-east-1. It was held by another Resend team; ownership was transferred, which revoked that team's access.
DNS published in Route53: DKIM at resend._domainkey, plus SPF and MX on send.scaffald.com.
All three senders ported — the notification adapter, send-team-invitation (which had its own copy of the SendGrid call), and the contact form.
Delivery webhook rewritten for Resend's event shape, and it now verifies the Svix signature. The SendGrid version accepted delivery statuses from anyone who found the URL.
The SPF concern in the original report does not apply. Resend sets the envelope sender to send.scaffald.com, so SPF is evaluated there and DMARC aligns to the apex through DKIM. The apex record keeps include:_spf.google.com ~all unchanged — widening it would have been wrong.
Remaining — needs the API key, which has to be installed by a human:
echo'RESEND_API_KEY=re_...'>> .env
npx supabase secrets set RESEND_API_KEY=re_... --project-ref qmfmpcyxsihhfttvqpbw
cd apps/scaffald && npx eas-cli@latest env:create --scope project \
--name RESEND_API_KEY --value re_... --type secret --environment production
Three separate runtimes, no shared secrets. EAS Hosting reads env at deploy time, so the contact form needs a redeploy after step three.
API key created and verified working. Confirmed against the live API:
key has domain access; scaffald.com reads status=verified, region=us-east-1
a real send from [email protected] reached last_event: delivered (id 31cc2676-…)
the contact endpoint itself returns 200 {"ok":true} end to end against Resend, exercising the real POST handler
So the transport is proven. Sending is not the remaining problem — deployment is, see #436: only 6 of the repo's 26 edge functions run in production, and notify-send-worker (the only function that actually dispatches a notification) is not one of them. core.notification_deliveries is empty.
That means the Supabase secret is correct to set but pre-positions the credential rather than fixing anything today. The step that produces a working feature right now is the EAS one, since the contact form runs on EAS Hosting and never touches Supabase.
Supabase edge function secrets — digest matches the known-good key
EAS Hosting — all three environments, --visibility sensitive
Live verification (2026-07-30):
POST https://scaffald.com/api/contact → 200 {"ok":true} (also direct to the EAS origin, ruling out CloudFront)
Both messages reached last_event: delivered in Resend — From Scaffald <[email protected]>, To [email protected], reply-to set to the submitter
Two deploy-time traps found on the way, both fixed in af85a9a5c and documented in docs/setup/RESEND.md:
--visibility secret is only decryptable inside the EAS build environment — the Hosting worker gets nothing and the route 503s while the deploy reports success. Server-side vars must be sensitive. A secret var can't be downgraded in place; delete and re-set.
eas deploy --prod does not load environment variables — --prod picks the URL, --environment production picks the vars. The CI workflow had the same bug and would have shipped every future worker with no server config.
scripts/set-resend-eas-env.sh now does the EAS half idempotently with validation.
What this does not fix: notification email. The senders aren't deployed — notify-send-worker and the rest of the pipeline are absent from production. That's #436.
Activity
thinkclay commentedon Jul 29, 2026
Resolved by moving all outbound mail to Resend rather than funding SendGrid —
83c7a33f6.Done:
scaffald.comclaimed and verified in theunicornResend team,us-east-1. It was held by another Resend team; ownership was transferred, which revoked that team's access.resend._domainkey, plus SPF and MX onsend.scaffald.com.send-team-invitation(which had its own copy of the SendGrid call), and the contact form.The SPF concern in the original report does not apply. Resend sets the envelope sender to
send.scaffald.com, so SPF is evaluated there and DMARC aligns to the apex through DKIM. The apex record keepsinclude:_spf.google.com ~allunchanged — widening it would have been wrong.Remaining — needs the API key, which has to be installed by a human:
Three separate runtimes, no shared secrets. EAS Hosting reads env at deploy time, so the contact form needs a redeploy after step three.
Optionally
RESEND_WEBHOOK_SECRETfrom https://resend.com/webhooks — until it is set the webhook rejects every event, so delivery tracking stays dark (mail still sends).Full runbook: docs/setup/RESEND.md
thinkclay commentedon Jul 29, 2026
API key created and verified working. Confirmed against the live API:
scaffald.comreadsstatus=verified,region=us-east-1[email protected]reachedlast_event: delivered(id31cc2676-…)200 {"ok":true}end to end against Resend, exercising the realPOSThandlerSo the transport is proven. Sending is not the remaining problem — deployment is, see #436: only 6 of the repo's 26 edge functions run in production, and
notify-send-worker(the only function that actually dispatches a notification) is not one of them.core.notification_deliveriesis empty.That means the Supabase secret is correct to set but pre-positions the credential rather than fixing anything today. The step that produces a working feature right now is the EAS one, since the contact form runs on EAS Hosting and never touches Supabase.
thinkclay commentedon Jul 30, 2026
Resolved and verified end to end in production.
Key installed in all three runtimes:
.env(local) — used for the verified test sends--visibility sensitiveLive verification (2026-07-30):
POST https://scaffald.com/api/contact→200 {"ok":true}(also direct to the EAS origin, ruling out CloudFront)last_event: deliveredin Resend — FromScaffald <[email protected]>, To[email protected], reply-to set to the submitterTwo deploy-time traps found on the way, both fixed in
af85a9a5cand documented in docs/setup/RESEND.md:--visibility secretis only decryptable inside the EAS build environment — the Hosting worker gets nothing and the route 503s while the deploy reports success. Server-side vars must besensitive. A secret var can't be downgraded in place; delete and re-set.eas deploy --proddoes not load environment variables —--prodpicks the URL,--environment productionpicks the vars. The CI workflow had the same bug and would have shipped every future worker with no server config.scripts/set-resend-eas-env.shnow does the EAS half idempotently with validation.What this does not fix: notification email. The senders aren't deployed —
notify-send-workerand the rest of the pipeline are absent from production. That's #436.