Skip to content

SendEmail.send returns a wrong type in development environment #13510

@ranile

Description

@ranile

What versions & operating system are you using?

  System:
    OS: macOS 26.3.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 90.88 MB / 18.00 GB
    Shell: 4.5.0 - /opt/homebrew/bin/fish
  Binaries:
    Node: 24.4.1 - /Users/elina/.local/state/fnm_multishells/45976_1776250154175/bin/node
    Yarn: 1.22.22 - /Users/elina/.local/state/fnm_multishells/45976_1776250154175/bin/yarn
    npm: 11.4.2 - /Users/elina/.local/state/fnm_multishells/45976_1776250154175/bin/npm
    pnpm: 10.28.1 - /Users/elina/.local/state/fnm_multishells/45976_1776250154175/bin/pnpm
    Deno: 2.6.10 - /opt/homebrew/bin/deno
  npmPackages:
    @cloudflare/vitest-pool-workers: ^0.12.4 => 0.12.21 
    wrangler: ^4.83.0 => 4.83.0 

Please provide a link to a minimal reproduction

https://github.com/ranile/cf-worker-email-send-wrong-type-bug

Describe the Bug

// ...
const result = await env.EMAIL.send(message);
console.log('email result', result); // logs undefined

Worker configuration has SendEmail.send typed as send(message: EmailMessage): Promise<EmailSendResult>;, however the real type is undefined

https://github.com/ranile/cf-worker-email-send-wrong-type-bug/blob/583d43210b0bd6577d10fab04dd17a31566cad87/worker-configuration.d.ts#L10788

Steps to reproduce:

  1. Clone repository
  2. pnpm install
  3. pnpm run dev
  4. curl localhost:8787

Please provide any relevant error logs

$ curl localhost:8787
undefined
[wrangler:info] send_email binding called with the following message:
  /var/folders/lw/m_yrcjv15f5bwgl1r25dr03w0000gn/T/miniflare-53ea533ca8803414f3caed41a5c41923/files/email/db254f42-c6ec-4c8c-b861-f5006b6254f7.eml
email result undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions