nitrojs / nitrojs/nitro

cloudflare: remaining dev emulation gaps after #4608

Open
#4,621 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

preset:cloudflare
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the miniflare runner and env-runner handling for inline Wrangler configuration, rootDir lookup, and named environments. Then inspect the /_nitro/tasks/:name endpoint and the production scheduled handler to compare runtime context and service bindings. Done when the listed dev-versus-production gaps are resolved and the behavior is covered by verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.