fix(miniflare): README incorrectly lists simulated email sending as unsupported

Aperta Adatta ai principianti
#17,110 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
85/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, markdown, typescript
Ambito
documentation

Direzione di ricerca

Inizia da packages/miniflare/README.md, alla voce Sending Email nel riferimento di configurazione per worker, che la indica come non supportata, e leggi packages/miniflare/test/plugins/email/index.spec.ts per confermare la forma di configurazione funzionante per un binding send_email. Aggiorna la voce del README per descrivere la simulazione locale come supportata e mostra la configurazione per l'API diretta new Miniflare(), precisando che la consegna esterna richiede ancora un servizio remoto. È completato quando un lettore riesce a seguire la configurazione del README e ottenere un HTTP 200 con un ID messaggio da un send() in testo semplice.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

The Miniflare API reference lists Sending Email as unsupported and points direct API consumers to a mock binding. The native local email plugin successfully handles a plain-text send() call in both the current stable and beta packages. Readers following the README can miss a working first-party simulator and write an unnecessary test double.

Steps to reproduce

  1. In separate scratch directories, install the respective stable and beta Miniflare releases listed below. Save the script as reproduce-send-email.mjs in each directory.
  2. Run the matching command in each directory. The script uses the direct Node API, starts a local simulator with a send_email binding, dispatches one request to an attachment-free fixture, and checks that the result is HTTP 200 with a message ID. It exits nonzero if the result differs.
  3. In each package's node_modules/miniflare/README.md, read the Sending Email entry under WorkerOptions. Compare the stated support with the result of the direct API call.
node reproduce-send-email.mjs
node reproduce-send-email.mjs --beta
Reproduction script: reproduce-send-email.mjs
import { Miniflare } from "miniflare";

const script = `
  export default {
    async fetch(request, env) {
      return Response.json(await env.EMAIL.send({
        from: "[email protected]",
        to: "[email protected]",
        subject: "Local simulation",
        text: "Control body",
      }));
    },
  };
`;

const mf = new Miniflare(process.argv.includes("--beta") ? {
  workers: [{ config: {
    name: "email-test",
    compatibilityDate: "2026-11-19",
    manifest: {
      mainModule: "worker.mjs",
      modules: { "worker.mjs": { type: "esm", contents: script } },
    },
    env: { EMAIL: { type: "send-email" } },
  } }],
} : {
  modules: true,
  script,
  compatibilityDate: "2026-07-30",
  email: { send_email: [{ name: "EMAIL" }] },
});

try {
  const response = await mf.dispatchFetch("http://localhost/");
  const result = await response.json();
  if (response.status !== 200 || typeof result.messageId !== "string") {
    throw new Error(`Expected a simulated send, received ${response.status}`);
  }
  console.log(response.status, "messageId returned");
} finally {
  await mf.dispose();
}

Expected behavior

The Miniflare README's binding reference should identify feature support accurately and give direct API consumers a working configuration to simulate email sending. Simulation should be described as local execution, with externally delivered mail requiring a remote service.

Actual behavior

Both installed package READMEs and the repository's current Miniflare README list Sending Email as unsupported in the worker binding reference. The direct Node API returned 200 messageId returned in both tested releases using the respective local email configurations. Neither fixture has a remote binding or starts a Wrangler CLI session.

Evidence

  • Expected source: Miniflare email plugin tests show direct new Miniflare() coverage for an unrestricted Email Sending binding and verify that a send() call returns a synthesized message ID.
  • Failure source: The Miniflare README places Sending Email in the unsupported list in the per-worker configuration reference. The same wording appears in both published READMEs, while the standalone Node script above succeeded with each package.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

Restoration check

The per-worker Miniflare API documentation should describe local sending as supported and show the email configuration applicable to that version of the direct API. Following that configuration should reproduce the attachment-free simulated send with HTTP 200 and a message ID.

Runtime or environment

Miniflare 4.20260730.0 under the npm latest tag with workerd 1.20260730.1 and Miniflare 5.20261119.0-beta under the beta tag with workerd 1.20261119.1. Both direct probes ran on Node.js 26.13.1, macOS 27.2.1 on arm64. Current repository README checked at b00799168dc2580013ea3c9b7d4f4505e120afa2.

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: The package API reference directs tool authors to mock a supported local email binding, adding avoidable work and making it harder to exercise the native simulator from Node.
  • Workaround status: available
  • Workaround basis: Configure the native local binding in the direct API as demonstrated for both package releases.
Lingua principale
TypeScript
Stelle
4.7k
Fork
1.7k
Merge medio
1g 22h
PR unite (30g)
287

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cloudflare/workers-sdk

Tutte le issue di cloudflare/workers-sdk

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.