8000 fix(prerender): report failed routes in prerender error by danielroe Β· Pull Request #5166 Β· nitrojs/nitro Β· GitHub
[go: up one dir, main page]

Skip to content

fix(prerender): report failed routes in prerender error - #5166

Open
danielroe wants to merge 1 commit into
nitrojs:mainfrom
danielroe:fix/prerender-error-message
Open

danielroe wants to merge 1 commit into
nitrojs:mainfrom
danielroe:fix/prerender-error-message

Conversation

@danielroe
Copy link
Copy Markdown
Member

πŸ”— Linked issue

❓ 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

when prerendering fails with prerender.failOnError enabled, the build ends with:

[nitro]
Errors prerendering:
[nitro]   β”œβ”€ /broken (50ms)
  β”‚ └── [500] boom
[nitro]

 ERROR  Exiting due to prerender errors.

    at prerender (.../node_modules/nitro/dist/_chunks/nitro4.mjs:305:9)

the message doesn't name the routes that failed or say what to do about them, and the stack points into nitro internals rather than the user's code.

this PR makes that error list the failing routes and their statuses, and mention the ways out: fix the route, add it to prerender.ignore, add its status code to prerender.ignoreStatusCodes, or set prerender.failOnError to false. it also collapses the error's stack to its name and message, for this throw and the Prerendered 0 routes throw that has the same problem.

πŸ“ Checklist

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

@danielroe
danielroe requested a review from pi0 as a code owner November 21, 2026 10:42
@vercel
vercel Bot commented Nov 21, 2026
Copy link
Copy Markdown

@danielroe 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 Nov 21, 2026 •
Copy link
Copy Markdown
Contributor

Explain Change β†’

No actionable comments were generated in the recent review.

Walkthrough

Prerender failures now use a shared error helper. Failure messages include a count, failed-route details, and remediation options. Tests check error messages, collapsed stacks, and route status reporting.

Changes: Prerender error reporting

Layer / File(s) Summary
Failure messages and validation
src/prerender/prerender.ts, test/prerender/fail-on-error.test.ts
The failure paths use a shared helper that limits the error stack to its name and message. When failOnError is enabled, the error message includes failed-route details and remediation options. Tests check route status reporting and ignored routes.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related issues

  • nitrojs/nitro#2906 β€” The error message includes fail-on-error configuration guidance. The issue also asks for crawler and concurrency settings, which this change does not address.

Suggested labels: prerender, bug

Merge Risk: Minimal Β· up to af3f1

This improves the prerender failure message by listing failed routes and suggesting remediation options. It only changes error text and stack output, so the risk of merging is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(prerender): report failed routes in prerender error" follows the Conventional Commits format with a valid type (fix) and scope (prerender). It matches the main change: the prerender err…
Description check Passed The description explains the problem with the current prerender error under failOnError. It lists the planned changes: naming failed routes and statuses, adding remediation options, and collapsing the…
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.
Full details: Title check

Explanation

The title "fix(prerender): report failed routes in prerender error" follows the Conventional Commits format with a valid type (fix) and scope (prerender). It matches the main change: the prerender error now names the failed routes and their statuses.

Full details: Description check

Explanation

The description explains the problem with the current prerender error under failOnError. It lists the planned changes: naming failed routes and statuses, adding remediation options, and collapsing the stack for the throw and the Prerendered 0 routes throw. This matches the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix Β· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eafaebbd-fedf-471a-beb5-d7fe32c9d992
Commits

Reviewing files that changed from the base of the PR and between 571aade and af3f1e0.

Files selected for processing: 2

  • src/prerender/prerender.ts
  • test/prerender/fail-on-error.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@pkg-pr-new
pkg-pr-new Bot commented Nov 21, 2026
Copy link
Copy Markdown

Open in StackBlitz

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

commit: af3f1e0

This branch has not been deployed

No deployments
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.

1 participant

0