[PR #374] [MERGED] fix: propagate page generateMetadata errors to error boundary #521

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/374
Author: @james-elicx
Created: 3/9/2026
Status: Merged
Merged: 3/9/2026
Merged by: @james-elicx

Base: j-branch-11Head: fix/metadata-error-propagation


📝 Commits (1)

  • 9077108 fix: propagate page generateMetadata errors to error boundary

📊 Changes

1 file changed (+14 additions, -6 deletions)

View changed files

📝 packages/vinext/src/server/app-dev-server.ts (+14 -6)

📄 Description

Summary

  • Fixes a regression introduced by the metadata/viewport parallelisation PR (#372)
  • Layout generateMetadata() errors are still swallowed (.catch(() => null)) — a layout failing shouldn't crash the page
  • Page generateMetadata() errors now propagate out of buildPageElement() so the caller routes them to the nearest error.tsx or global-error.tsx boundary

Root Cause

The parallelisation PR applied .catch(() => null) to all modules including the page module. This silently swallowed errors thrown by page.generateMetadata(), preventing the error boundary from being triggered.

Fix

Separate layout modules from the page module when resolving metadata/viewport in buildPageElement():

  • Layouts: .catch(() => null) — failures are non-fatal
  • Page: no .catch() — errors propagate to the caller, which routes to error.tsx / global-error.tsx

Test

The previously failing test now passes:

tests/nextjs-compat/global-error.test.ts
  > generateMetadata() error caught by local error.tsx boundary  ✓

🔄 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/374 **Author:** [@james-elicx](https://github.com/james-elicx) **Created:** 3/9/2026 **Status:** ✅ Merged **Merged:** 3/9/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `j-branch-11` ← **Head:** `fix/metadata-error-propagation` --- ### 📝 Commits (1) - [`9077108`](https://github.com/cloudflare/vinext/commit/9077108b775d10f1e690b2bef77986d544102cda) fix: propagate page generateMetadata errors to error boundary ### 📊 Changes **1 file changed** (+14 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/server/app-dev-server.ts` (+14 -6) </details> ### 📄 Description ## Summary - Fixes a regression introduced by the metadata/viewport parallelisation PR (#372) - Layout `generateMetadata()` errors are still swallowed (`.catch(() => null)`) — a layout failing shouldn't crash the page - Page `generateMetadata()` errors now propagate out of `buildPageElement()` so the caller routes them to the nearest `error.tsx` or `global-error.tsx` boundary ## Root Cause The parallelisation PR applied `.catch(() => null)` to **all** modules including the page module. This silently swallowed errors thrown by `page.generateMetadata()`, preventing the error boundary from being triggered. ## Fix Separate layout modules from the page module when resolving metadata/viewport in `buildPageElement()`: - **Layouts**: `.catch(() => null)` — failures are non-fatal - **Page**: no `.catch()` — errors propagate to the caller, which routes to `error.tsx` / `global-error.tsx` ## Test The previously failing test now passes: ``` tests/nextjs-compat/global-error.test.ts > generateMetadata() error caught by local error.tsx boundary ✓ ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:08:31 +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#521
No description provided.