[PR #947] [MERGED] fix: report stale ISR background revalidation errors via onRequestError #975

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/947
Author: @Divkix
Created: 4/29/2026
Status: Merged
Merged: 4/29/2026
Merged by: @james-elicx

Base: mainHead: fix/775-report-isr-revalidation-errors


📝 Commits (3)

  • 4e59483 fix: report stale ISR background revalidation errors via onRequestError (#775)
  • 7cadb5e fix: remove dead ISRRegenErrorContext export flagged by knip
  • bebbe22 Merge branch 'origin/main' into fix/775-report-isr-revalidation-errors

📊 Changes

9 files changed (+425 additions, -173 deletions)

View changed files

📝 packages/vinext/src/entries/app-rsc-entry.ts (+22 -4)
📝 packages/vinext/src/entries/pages-server-entry.ts (+2 -2)
📝 packages/vinext/src/server/dev-server.ts (+115 -103)
📝 packages/vinext/src/server/isr-cache.ts (+26 -1)
📝 packages/vinext/src/server/pages-page-data.ts (+45 -33)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+134 -26)
📝 tests/app-router.test.ts (+2 -2)
📝 tests/entry-templates.test.ts (+6 -2)
📝 tests/isr-cache.test.ts (+73 -0)

📄 Description

Fixes #775

Summary

  • ISR background revalidation errors are now reported via onRequestError instrumentation hook (Sentry, OpenTelemetry, etc.) instead of being silently swallowed
  • Extended triggerBackgroundRegeneration() in isr-cache.ts with optional error context parameter
  • Updated App Router and Pages Router entry templates to pass route context to background regen callbacks
  • Error reports include revalidateReason: "stale", matching Next.js 16 behavior (vercel/next.js#92282)

Changes

  • server/isr-cache.ts: Added ISRRegenErrorContext type and error reporting in background regen catch
  • entries/app-rsc-entry.ts: Updated inline __triggerBackgroundRegeneration to call _reportRequestError
  • entries/pages-server-entry.ts: Forward error context through wrapper function
  • server/dev-server.ts: Pass Pages Router route context to regen calls
  • server/pages-page-data.ts: Pass route context for Pages Router page data regen
  • Updated test snapshots and assertions

Test plan

  • All existing ISR cache tests pass (42 tests)
  • Entry template tests pass with updated snapshots
  • App Router integration tests pass (383 tests)
  • Lint, format, and typecheck 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/947 **Author:** [@Divkix](https://github.com/Divkix) **Created:** 4/29/2026 **Status:** ✅ Merged **Merged:** 4/29/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/775-report-isr-revalidation-errors` --- ### 📝 Commits (3) - [`4e59483`](https://github.com/cloudflare/vinext/commit/4e5948379cb465f650cc318912fe6f88b4dc4b2a) fix: report stale ISR background revalidation errors via onRequestError (#775) - [`7cadb5e`](https://github.com/cloudflare/vinext/commit/7cadb5e2e721a43291bdccbe418a0a70b2f1482d) fix: remove dead ISRRegenErrorContext export flagged by knip - [`bebbe22`](https://github.com/cloudflare/vinext/commit/bebbe22e3997820bbbb02e5726fd4e8cbc622d90) Merge branch 'origin/main' into fix/775-report-isr-revalidation-errors ### 📊 Changes **9 files changed** (+425 additions, -173 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+22 -4) 📝 `packages/vinext/src/entries/pages-server-entry.ts` (+2 -2) 📝 `packages/vinext/src/server/dev-server.ts` (+115 -103) 📝 `packages/vinext/src/server/isr-cache.ts` (+26 -1) 📝 `packages/vinext/src/server/pages-page-data.ts` (+45 -33) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+134 -26) 📝 `tests/app-router.test.ts` (+2 -2) 📝 `tests/entry-templates.test.ts` (+6 -2) 📝 `tests/isr-cache.test.ts` (+73 -0) </details> ### 📄 Description Fixes #775 ## Summary - ISR background revalidation errors are now reported via `onRequestError` instrumentation hook (Sentry, OpenTelemetry, etc.) instead of being silently swallowed - Extended `triggerBackgroundRegeneration()` in `isr-cache.ts` with optional error context parameter - Updated App Router and Pages Router entry templates to pass route context to background regen callbacks - Error reports include `revalidateReason: "stale"`, matching Next.js 16 behavior (vercel/next.js#92282) ## Changes - `server/isr-cache.ts`: Added `ISRRegenErrorContext` type and error reporting in background regen catch - `entries/app-rsc-entry.ts`: Updated inline `__triggerBackgroundRegeneration` to call `_reportRequestError` - `entries/pages-server-entry.ts`: Forward error context through wrapper function - `server/dev-server.ts`: Pass Pages Router route context to regen calls - `server/pages-page-data.ts`: Pass route context for Pages Router page data regen - Updated test snapshots and assertions ## Test plan - All existing ISR cache tests pass (42 tests) - Entry template tests pass with updated snapshots - App Router integration tests pass (383 tests) - Lint, format, and typecheck 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#975
No description provided.