Volter World

Worker outbound requests cross the Node fetch boundary

Status: Proposed. Card t_a31a10fc.

The World's Miniflare outbound handler receives Miniflare's Request. Passing it unchanged to Node's global fetch or Miniflare's imported undici fetch can fail with TypeError: Failed to parse URL from [object Request]: the receiving implementation does not recognize the foreign Request constructor.

The injector converts ordinary HTTP requests at both boundaries to a URL and explicit RequestInit. It reads the method, headers, body, signal, redirect and other standard fetch options through the Request's getters; spreading the Request would omit them. Headers become entry pairs. The original body stream is passed with duplex: 'half', without buffering or replaying it.

The existing destination choice still owns routing: mapped hosts use patched global fetch, other hosts use the World's proxy when configured, and loopback uses the proxy's existing exclusion. Network policy and redirect handling stay in those paths. WebSocket upgrades use Miniflare's own fetch because Node fetch cannot return its upgraded socket response. Application-supplied outbound services retain their ownership.

This is the card's implementation proposal, revisable by later cards. The architecture owns the injector contract.

View Markdown source