Skip to content

fix(ci): include RESEND_API_KEY in wot-api --set-secrets so autodeploy stops dropping it#240

Merged
saitejesh-cyber merged 1 commit into
mainfrom
fix/cloudbuild-resend-api-key-secret
May 22, 2026
Merged

fix(ci): include RESEND_API_KEY in wot-api --set-secrets so autodeploy stops dropping it#240
saitejesh-cyber merged 1 commit into
mainfrom
fix/cloudbuild-resend-api-key-secret

Conversation

@saitejesh-cyber
Copy link
Copy Markdown
Collaborator

Summary

The deploy-api step's --set-secrets flag replaces the Cloud Run service's entire secret set on every deploy. Any secret not in that list is silently dropped from the next revision.

RESEND_API_KEY was provisioned on wot-api manually (gcloud run services update) after this list was last written, so it was never added to the flag. It survived only until the next autodeploy.

Impact (observed in production)

When PR #239 was deployed:

  • wot-main-autodeploy ran cloudbuild.yaml--set-secrets rebuilt the secret set without RESEND_API_KEY.
  • New revision wot-api-00112 came up missing the key.
  • default_client() in world_of_taxonomy/auth/email.py saw no RESEND_API_KEY → fell back to NoopEmailClient.
  • Every magic-link sign-in email was silently dropped (/developers/signup still returns 202, so there is no visible error).

The key was restored manually as revision wot-api-00113, but the next autodeploy would drop it again — this PR makes the fix durable.

Change

One line — adds RESEND_API_KEY=RESEND_API_KEY:latest to the deploy-api --set-secrets list, plus a comment explaining the replace-not-merge semantics so the next secret is not omitted the same way.

Safety

  • The RESEND_API_KEY secret already exists in Secret Manager (colaberry-wot).
  • The wot-api Cloud Run runtime service account already has secretmanager.secretAccessor on it (revisions 00110 / 00111 / 00113 mounted it fine).
  • No new infra, no value in the repo. cloudbuild.yaml parses as valid YAML.

Note (not in this PR)

RESEND_SENDER is a plain env var, not a secret — it currently persists across deploys only because the deploy-api step has no --set-env-vars. That is fine today but is implicit; worth making explicit later if env handling changes.

🤖 Generated with Claude Code

The deploy-api step's `--set-secrets` flag REPLACES the Cloud Run
service's entire secret set on every deploy. RESEND_API_KEY was added
to wot-api manually (via `gcloud run services update`) after this list
was last written, so it was not in the flag - and the next autodeploy
silently dropped it.

Effect: wot-api lost RESEND_API_KEY on deploy, `default_client()` fell
back to NoopEmailClient, and every magic-link sign-in email was
silently dropped (signup still returns 202). Observed live on revision
wot-api-00112; restored manually as wot-api-00113.

Adds RESEND_API_KEY=RESEND_API_KEY:latest to the list so the secret
survives every autodeploy. The secret already exists in Secret Manager
and the Cloud Run runtime service account already has accessor rights.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@saitejesh-cyber saitejesh-cyber merged commit b15cbee into main May 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant