Skip to content

Add Sentry observability for rate-limit cache failures and missing RESEND_API_KEY #478

Closed

Description

@neuromechanist

Context

Two findings from the #474 release review (silent-failure-hunter):

Rate-limit cache failures

backend/src/middleware/rateLimit.ts:208-213 — when the Cloudflare Cache API throws (cold starts, regional issues), the fail-open path only calls console.error. Workers logs are not aggregated into our Sentry/dashboard. Sustained cache failures would be invisible — rate limiting silently disabled.

Missing RESEND_API_KEY

backend/src/routes/admin.ts — sendBroadcast() is called at 6 sites with c.env.RESEND_API_KEY passed unchecked. When the secret is missing, the function returns a 200 OK with all recipients recorded as failures. Admins get no signal that the key is misconfigured.

Proposal

  1. Add a logError(err, { context }) helper that posts to Sentry AND console.error in one call.
  2. Wire it into the rate-limit catch block with { context: 'rate-limit-cache' }.
  3. Add a precondition check at each sendBroadcast site (or inside the function): if RESEND_API_KEY is empty/missing, return a structured error to the admin (500 with { error: 'email_service_unconfigured' }) instead of pretending the send succeeded.

Activity

  1. added
    infrastructure
    on May 14, 2026
  2. neuromechanist commented on May 14, 2026

    @neuromechanist
    ContributorAuthor

    Merged via PR #483.

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

    infrastructure

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions