Skip to content

Fix Illegal invocation in moderation emails - #233

Merged
admdly merged 1 commit into
mainfrom
fix-email-fetch-binding
Sep 17, 2026
Merged

admdly merged 1 commit into
mainfrom
fix-email-fetch-binding

Conversation

@admdly

@admdly admdly commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Both email senders defaulted to a bare globalThis.fetch reference, which throws Illegal invocation on Cloudflare Workers (fetch requires its this receiver). This broke all moderation notifications regardless of provider, surfacing as notified: false (e.g. developer-approved). Adds a bound defaultFetch wrapper in email/types.ts and uses it as the default in MxrouteSender and ResendSender.

Adds a regression test that stubs globalThis.fetch with Workers-like this enforcement and covers both senders plus the createEmailSender(env) factory path used by notify.ts.

@admdly admdly self-assigned this Sep 17, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Auto-approved: Fixes Cloudflare Workers fetch binding for both moderation email providers and the factory path. The focused regression test verifies the corrected behavior without changing rollout, contracts, or operational policy.

Re-trigger cubic

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
api 18a42a8 Commit Preview URL

Branch Preview URL
Sep 17 2026, 02:07 PM

@admdly
admdly merged commit b158dab into main Sep 17, 2026
9 checks passed
@admdly
admdly deleted the fix-email-fetch-binding branch September 17, 2026 14:21
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