Skip to content

fix: exclude wrangler from generated NitroRuntimeConfig type - #4149

Merged
pi0 merged 1 commit into
nitrojs:mainfrom
johannschopplich:fix/exclude-wrangler-from-runtime-config-types
Apr 2, 2026
Merged

pi0 merged 1 commit into
nitrojs:mainfrom
johannschopplich:fix/exclude-wrangler-from-runtime-config-types

Conversation

@johannschopplich

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves #4148

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

The Cloudflare dev preset (src/presets/cloudflare/dev.ts) injects a wrangler key into runtimeConfig at module installation time to share Miniflare configuration (config path, persist dir, environment) with the runtime plugin.

However, this internal key is not filtered out during type generation in src/build/types.ts. The existing filter only excludes app and nitro:

Object.entries(nitro.options.runtimeConfig).filter(
  ([key]) => !["app", "nitro"].includes(key)
)

This causes wrangler to appear in the generated NitroRuntimeConfig interface (node_modules/.nitro/types/nitro-config.d.ts), which then produces a type error in the user's nitro.config.ts because wrangler is a required property that the user never defined.

Steps to reproduce:

  1. Create a Nitro project with preset: 'cloudflare_module'
  2. Run nitro dev (or nitro prepare — the Cloudflare dev module runs in both)
  3. Stop the dev server
  4. Run tsc --noEmit
  5. Type error: Property 'wrangler' is missing in type '...' but required in type 'NitroRuntimeConfig'

Fix: Add wrangler to the exclusion list alongside app and nitro.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@johannschopplich
johannschopplich requested a review from pi0 as a code owner March 25, 2026 12:53
@vercel

vercel Bot commented Mar 25, 2026

Copy link
Copy Markdown

@johannschopplich is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 603864dd-dfc4-468c-8570-ee014e7f5a70

📥 Commits

Reviewing files that changed from the base of the PR and between 9ce219c and 5ce09e5.

📒 Files selected for processing (1)
  • src/build/types.ts

📝 Walkthrough

Walkthrough

The change filters the wrangler key from runtime config type generation alongside existing app and nitro exclusions. This prevents internal configuration injected by the Cloudflare dev preset from appearing in the generated NitroRuntimeConfig type definition.

Changes

Cohort / File(s) Summary
Runtime Config Type Filtering
src/build/types.ts
Added "wrangler" to the exclusion list in the runtime config filter to prevent the Cloudflare dev preset's internal configuration key from appearing in generated type definitions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows conventional commits format with 'fix:' prefix and clearly describes the specific change of excluding 'wrangler' from the generated NitroRuntimeConfig type.
Description check ✅ Passed The description is directly related to the changeset, explaining the bug, reproduction steps, and the fix being applied to exclude the wrangler key.
Linked Issues check ✅ Passed The PR successfully addresses the objective from issue #4148 by adding 'wrangler' to the exclusion filter list in src/build/types.ts, preventing it from appearing in the generated NitroRuntimeConfig type.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to the specific fix required: modifying the filter list in src/build/types.ts to exclude 'wrangler', with no extraneous or unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new

pkg-pr-new Bot commented Mar 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nitro@4149

commit: 5ce09e5

@pi0 pi0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thnx!

@pi0
pi0 merged commit a5a3389 into nitrojs:main Apr 2, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cloudflare dev preset leaks wrangler into generated NitroRuntimeConfig type

2 participants