Skip to content

fix(miniflare): return EmailSendResult from send_email binding's send()#13577

Merged
dario-piotrowicz merged 3 commits intocloudflare:mainfrom
connyay:cjh/miniflare-send-email-result
Apr 20, 2026
Merged

fix(miniflare): return EmailSendResult from send_email binding's send()#13577
dario-piotrowicz merged 3 commits intocloudflare:mainfrom
connyay:cjh/miniflare-send-email-result

Conversation

@connyay
Copy link
Copy Markdown
Contributor

@connyay connyay commented Apr 17, 2026

The binding's send() resolved to undefined, diverging from production (and the public SendEmail type), which returns { messageId }. Workers that inspect the return value now see the same shape locally as deployed.

  • EmailMessage path: echo the parsed Message-ID with angle brackets stripped
  • MessageBuilder path: synthesize the id in the same <hex>@example.com form already used by the forward() path

  • 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: matching prod behavior

A picture of a cute animal (not mandatory, but encouraged)
https://www.youtube.com/watch?v=FykoipfMyNQ


Open with Devin

The binding's `send()` resolved to `undefined`, diverging from production
(and the public `SendEmail` type), which returns `{ messageId }`. Workers
that inspect the return value now see the same shape locally as deployed.

- EmailMessage path: echo the parsed Message-ID with angle brackets stripped
- MessageBuilder path: synthesize the id in the same `<hex>@example.com`
  form already used by the forward() path
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 17, 2026

🦋 Changeset detected

Latest commit: 2df9c5c

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 17, 2026
@workers-devprod workers-devprod requested review from a team and dario-piotrowicz and removed request for a team April 17, 2026 03:08
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Apr 17, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@connyay
Copy link
Copy Markdown
Contributor Author

connyay commented Apr 17, 2026

I hit this trying to wire up email sending in workers-rs 👉 cloudflare/workers-rs#975

devin-ai-integration[bot]

This comment was marked as resolved.

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 17, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

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

commit: 2df9c5c

Comment thread packages/miniflare/test/plugins/email/index.spec.ts Outdated
@connyay connyay requested a review from Skye-31 April 17, 2026 18:28
Copy link
Copy Markdown
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks @connyay 🙏

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

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 20, 2026
@dario-piotrowicz dario-piotrowicz merged commit e456952 into cloudflare:main Apr 20, 2026
63 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Apr 20, 2026
@connyay connyay deleted the cjh/miniflare-send-email-result branch April 20, 2026 12:21
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.

SendEmail.send returns a wrong type in development environment

5 participants