Skip to content

fix(vite): propagate service fetch errors in dev to match production#4335

Merged
pi0 merged 2 commits into
mainfrom
fix/vite-dev-errs
Jun 10, 2026
Merged

fix(vite): propagate service fetch errors in dev to match production#4335
pi0 merged 2 commits into
mainfrom
fix/vite-dev-errs

Conversation

@pi0x

@pi0x pi0x commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

No description provided.

In dev, the vite env runner caught errors from service entries and rendered them in the worker, so `HTTPError` status/headers never reached the nitro h3 error handler like they do in production. Errors now propagate to the caller; the dev error page is only rendered at the env-runner fetch boundary.
@pi0x pi0x requested a review from pi0 as a code owner June 10, 2026 16:59
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nitro.build Ready Ready Preview, Comment Jun 10, 2026 5:08pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

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: 5dd12288-4416-4838-b844-56c1e4445abd

📥 Commits

Reviewing files that changed from the base of the PR and between 0511b8c and b0f6195.

📒 Files selected for processing (1)
  • test/vite/app-fixture/app/entry-server.ts

📝 Walkthrough

Walkthrough

Internal Vite env fetch now throws entry/load errors; the exported async fetch(req) catches those and converts them to error responses. The SSR entry fixture throws an HTTPError on ?error, and an added test asserts the status and header survive the round trip.

Changes

Error handling refactor in Vite dev worker

Layer / File(s) Summary
ViteEnvRunner.fetch and exported fetch wrapper
src/runtime/internal/vite/dev-worker.mjs
ViteEnvRunner.fetch retries while the entry loads and now throws entryError, 503, or 500 instead of rendering; the exported fetch(req) is now async and wraps env.fetch(req) in a try/catch to return renderError(req, error) when env.fetch throws.
SSR entry fixture and integration test
test/vite/app-fixture/app/entry-server.ts, test/vite/app.test.ts
The SSR entry handler now accepts Request and throws an HTTPError (status 418, x-test: 123) when ?error is present. A new test fetches /?error and asserts the response preserves the 418 status and x-test header.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess relevance to the changeset. Add a description explaining the changes, their purpose, and any relevant context for reviewers.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title follows conventional commits format with 'fix' type and descriptive scope/subject clearly related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vite-dev-errs

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


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 Jun 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: b0f6195

@pi0 pi0 merged commit b4f3e2b into main Jun 10, 2026
12 of 13 checks passed
@pi0 pi0 deleted the fix/vite-dev-errs branch June 10, 2026 17:11
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.

2 participants