[PR #945] [MERGED] fix: add ForbiddenBoundary/UnauthorizedBoundary for HTTP access fallback recovery (#764) #973

Closed
opened 2026-05-06 13:11:20 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/945
Author: @Divkix
Created: 4/29/2026
Status: Merged
Merged: 4/30/2026
Merged by: @james-elicx

Base: mainHead: fix/764-prerender-http-error-boundaries


📝 Commits (8)

  • a289336 fix: add ForbiddenBoundary/UnauthorizedBoundary for HTTP access fallback recovery (#764)
  • 6eb7add fix: address review feedback on ForbiddenBoundary/UnauthorizedBoundary (#945)
  • d14afd4 fix: remove duplicate forbidden/unauthorized path iteration and update comment
  • 2d3b448 fix: align NotFoundBoundary digest matching and tests with Forbidden/Unauthorized patterns
  • 9b01172 fix: resolve rebase conflicts — align manifest code with main refactor
  • c59536a fix: add null guards for notFoundPaths, forbiddenPaths, unauthorizedPaths in manifest
  • 0682267 fix: reorder route-level boundary nesting for merge with main
  • 31b61fe merge: resolve conflict with main in app-page-route-wiring.tsx

📊 Changes

13 files changed (+444 additions, -100 deletions)

View changed files

📝 packages/vinext/src/entries/app-rsc-entry.ts (+2 -0)
📝 packages/vinext/src/entries/app-rsc-manifest.ts (+15 -9)
📝 packages/vinext/src/routing/app-router.ts (+11 -7)
📝 packages/vinext/src/server/app-page-route-wiring.tsx (+64 -5)
📝 packages/vinext/src/shims/error-boundary.tsx (+129 -1)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+90 -66)
📝 tests/app-router.test.ts (+16 -0)
📝 tests/entry-templates.test.ts (+13 -6)
📝 tests/error-boundary.test.ts (+94 -6)
📝 tests/prerender.test.ts (+2 -0)
📝 tests/route-classification-manifest.test.ts (+4 -0)
📝 tests/routing.test.ts (+2 -0)
📝 tests/shims.test.ts (+2 -0)

📄 Description

Fixes #764

Summary

  • Added ForbiddenBoundary and UnauthorizedBoundary client components (matching NotFoundBoundary) that catch NEXT_HTTP_ERROR_FALLBACK;403 and NEXT_HTTP_ERROR_FALLBACK;401 digests during RSC rendering
  • Wired ForbiddenBoundary/UnauthorizedBoundary into the App Router component tree at route and per-layout levels in buildAppPageElements
  • Added per-layout forbiddenPaths/unauthorizedPaths discovery in the router and codegen pipeline
  • Without these boundaries, 403/401 errors thrown during RSC rendering (e.g. inside Suspense boundaries) escaped into the generic error shell, producing mismatched Flight/HTML data and client-side errors

Upstream

Next.js PR: https://github.com/vercel/next.js/pull/92231

Test plan

  • Updated snapshot tests for generated entry templates
  • Added digest classification tests for ForbiddenBoundary and UnauthorizedBoundary
  • Existing integration tests for forbidden()/unauthorized() still pass

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/945 **Author:** [@Divkix](https://github.com/Divkix) **Created:** 4/29/2026 **Status:** ✅ Merged **Merged:** 4/30/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/764-prerender-http-error-boundaries` --- ### 📝 Commits (8) - [`a289336`](https://github.com/cloudflare/vinext/commit/a289336ebad07bbf36d3e44746b146b686932991) fix: add ForbiddenBoundary/UnauthorizedBoundary for HTTP access fallback recovery (#764) - [`6eb7add`](https://github.com/cloudflare/vinext/commit/6eb7add63efbee1f654b294c3926fadb77c16e07) fix: address review feedback on ForbiddenBoundary/UnauthorizedBoundary (#945) - [`d14afd4`](https://github.com/cloudflare/vinext/commit/d14afd4387b2a6fb437ce0fb4aefb62ca74fa545) fix: remove duplicate forbidden/unauthorized path iteration and update comment - [`2d3b448`](https://github.com/cloudflare/vinext/commit/2d3b4487e9bed50280bc2e1b5972bb1d8f937e4f) fix: align NotFoundBoundary digest matching and tests with Forbidden/Unauthorized patterns - [`9b01172`](https://github.com/cloudflare/vinext/commit/9b011724258434b544c3f3f32a4ce0b4d888bc61) fix: resolve rebase conflicts — align manifest code with main refactor - [`c59536a`](https://github.com/cloudflare/vinext/commit/c59536a10a2b52027a7d9fcdae9e661d83529c7c) fix: add null guards for notFoundPaths, forbiddenPaths, unauthorizedPaths in manifest - [`0682267`](https://github.com/cloudflare/vinext/commit/0682267c180fa115c7e91fb759301828ec807864) fix: reorder route-level boundary nesting for merge with main - [`31b61fe`](https://github.com/cloudflare/vinext/commit/31b61feeda10545a87e7bb9639596d620e42b015) merge: resolve conflict with main in app-page-route-wiring.tsx ### 📊 Changes **13 files changed** (+444 additions, -100 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+2 -0) 📝 `packages/vinext/src/entries/app-rsc-manifest.ts` (+15 -9) 📝 `packages/vinext/src/routing/app-router.ts` (+11 -7) 📝 `packages/vinext/src/server/app-page-route-wiring.tsx` (+64 -5) 📝 `packages/vinext/src/shims/error-boundary.tsx` (+129 -1) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+90 -66) 📝 `tests/app-router.test.ts` (+16 -0) 📝 `tests/entry-templates.test.ts` (+13 -6) 📝 `tests/error-boundary.test.ts` (+94 -6) 📝 `tests/prerender.test.ts` (+2 -0) 📝 `tests/route-classification-manifest.test.ts` (+4 -0) 📝 `tests/routing.test.ts` (+2 -0) 📝 `tests/shims.test.ts` (+2 -0) </details> ### 📄 Description Fixes #764 ## Summary - Added `ForbiddenBoundary` and `UnauthorizedBoundary` client components (matching `NotFoundBoundary`) that catch `NEXT_HTTP_ERROR_FALLBACK;403` and `NEXT_HTTP_ERROR_FALLBACK;401` digests during RSC rendering - Wired ForbiddenBoundary/UnauthorizedBoundary into the App Router component tree at route and per-layout levels in `buildAppPageElements` - Added per-layout `forbiddenPaths`/`unauthorizedPaths` discovery in the router and codegen pipeline - Without these boundaries, 403/401 errors thrown during RSC rendering (e.g. inside Suspense boundaries) escaped into the generic error shell, producing mismatched Flight/HTML data and client-side errors ## Upstream Next.js PR: https://github.com/vercel/next.js/pull/92231 ## Test plan - Updated snapshot tests for generated entry templates - Added digest classification tests for ForbiddenBoundary and UnauthorizedBoundary - Existing integration tests for forbidden()/unauthorized() still pass --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:20 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#973
No description provided.