Repository navigation
Validate RESEND_API_KEY and structured rate-limit logs - #483
Merged
Merged
Conversation
Augment the catch block with route, keyKind, and error message so Workers tail logs surface cache outages. Adds TODO for Sentry.
Return email_service_unconfigured (broadcast_id: -1) instead of silently recording all recipients as failures. Route handler maps this to HTTP 500 so admins see the real cause. Tests cover empty, whitespace, and valid-key paths.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR483Version: 🤖 Updated on each push. |
This was referenced May 14, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #478
Part 1: rate-limit cache observability
backend/src/middleware/rateLimit.ts— the catch block now emits a structured log with{ route, keyKind, error }instead of a bare string, making Workers tail-log filtering actionable. A TODO marks where a Sentry capture belongs once a DSN is wired.Part 2: RESEND_API_KEY precondition
backend/src/services/broadcast.ts—sendBroadcastnow short-circuits at the top if the key is empty or whitespace, returning{ broadcast_id: -1, error: "email_service_unconfigured" }. The/admin/notifyroute handler maps that to HTTP 500 so admins see the real problem rather than a 200 with every recipient marked failed.Tests
test/broadcast.test.ts— 3 new tests (24 total, all pass):