Skip to content

fix(miniflare): expose send_email in platform proxy#13723

Merged
edmundhung merged 5 commits into
mainfrom
fix/send-email-platform-proxy
Apr 30, 2026
Merged

fix(miniflare): expose send_email in platform proxy#13723
edmundhung merged 5 commits into
mainfrom
fix/send-email-platform-proxy

Conversation

@edmundhung

@edmundhung edmundhung commented Apr 29, 2026

Copy link
Copy Markdown
Member

Fixes #13715

This was not originally supported because email bindings relied on the EmailMessage class from cloudflare:email module, which is not available in the Node environment. Now that send_email supports the plain-object MessageBuilder interface, I think we should be able to enable this through the getPlatformProxy().

The local email binding previously used Miniflare's loopback server to write preview files. That deadlocks when called through the Node proxy, so this switches those file writes to a workerd disk service instead.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bugfix

A picture of a cute animal (not mandatory, but encouraged)


Open in Devin Review

@changeset-bot

changeset-bot Bot commented Apr 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 82700f0

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Apr 29, 2026
@workers-devprod workers-devprod requested review from a team and vicb and removed request for a team April 29, 2026 12:46
@workers-devprod

workers-devprod commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@github-actions

github-actions Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

⚠️ Issues found

.changeset/email-platform-proxy.md

  • Version Type Issue: This changeset is marked as patch, but according to the changeset guidelines, new features should use minor versioning. The change "Expose send_email bindings from getPlatformProxy()" is a new feature that adds support for send_email bindings in the platform proxy. The guidelines state:

    • minor: New features, new CLI commands, new configuration options, deprecations, and changes to experimental/beta/pre-1.0 features

    This should be changed from patch to minor.


Suggested fix:

---
"miniflare": minor
---

Expose `send_email` bindings from `getPlatformProxy()`

Projects developing in Node can now access `send_email` bindings from the platform proxy. This supports the plain-object MessageBuilder API locally, so calls like `env.EMAIL.send({ from, to, subject, text })` no longer fail because the binding is missing.

@ask-bonk

ask-bonk Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

UnknownError: ProviderInitError

github run

@ask-bonk

ask-bonk Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

@edmundhung Bonk workflow failed. Check the logs for details.

View workflow run · To retry, trigger Bonk again.

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Apr 29, 2026

Copy link
Copy Markdown
create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13723

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13723

miniflare

npm i https://pkg.pr.new/miniflare@13723

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13723

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13723

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13723

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13723

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13723

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@13723

wrangler

npm i https://pkg.pr.new/wrangler@13723

commit: 82700f0

@edmundhung edmundhung force-pushed the fix/send-email-platform-proxy branch 2 times, most recently from 2ab37cc to 4b36bb3 Compare April 29, 2026 14:30
devin-ai-integration[bot]

This comment was marked as resolved.

@edmundhung edmundhung force-pushed the fix/send-email-platform-proxy branch from 4b36bb3 to ec39d73 Compare April 29, 2026 14:45
devin-ai-integration[bot]

This comment was marked as resolved.

edmundhung and others added 2 commits April 29, 2026 15:53
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread packages/miniflare/src/workers/email/send_email.worker.ts
Comment thread packages/wrangler/e2e/get-platform-proxy.test.ts Outdated
Comment thread packages/miniflare/test/plugins/email/index.spec.ts

@vicb vicb 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.

LGTM

@workers-devprod workers-devprod 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.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Apr 30, 2026
@edmundhung edmundhung merged commit e653edf into main Apr 30, 2026
64 of 65 checks passed
@edmundhung edmundhung deleted the fix/send-email-platform-proxy branch April 30, 2026 16:07
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Can't use send_email binding when in local development using proxy bindings

3 participants