#4621·nitro

cloudflare: remaining dev emulation gaps after #4608

Author: pi0xCreated Sep 13, 2026Updated Sep 14, 2026
Labelspreset:cloudflare

Follow-up to #4608. These gaps in Cloudflare dev emulation (miniflare runner) were found during review and are still open.

Needs changes in env-runner:

  • When cloudflare.wrangler is set inline, the wrangler config file is only looked up in the cwd, not rootDir. If the inline env map lacks the selected wranglerEnv, the file's bindings are dropped too. Nitro needs a way to pass an explicit config path together with the inline config.

Nitro side:

  • Dev and production resolve named environments differently. Dev applies wranglerEnv to the inline config and the file separately and then merges the results, while the build merges the raw configs first. Inline top-level bindings are visible in dev but not after deploy.
  • The /_nitro/tasks/:name dev endpoint runs tasks without context.cloudflare, which the production scheduled handler provides.
  • Service bindings to other workers are now removed in dev without a warning, so env.MY_SERVICE is just undefined.

Request forwarding, the request runtime context and the leaked internal bindings were fixed in env-runner 0.2.2 (unjs/env-runner#50).

Opened with AI assistance.