Commit Graph

11 Commits

Author SHA1 Message Date
Jiwon Choi d7aa66c345 Remove generated error codes (#97687)
### Why?

Should come up with better solution that does not block PRs with git
conflict

x-ref:
https://vercel.slack.com/archives/C02CDC2ALJH/p1785263902728189?thread_ts=1785263687.502649&cid=C02CDC2ALJH

### How?

- Delete `errors.json`, the error-code SWC plugin, generated WASM, merge
driver, and validation/build tooling.
- Stop attaching error codes to server-rendering digests, redboxes, and
telemetry; native `Error.code` and `Error.name` remain available where
applicable.
- Remove the development-overlay error feedback UI, middleware, and
telemetry event that depended on stable codes.
- Update fixtures, snapshots, and guidance for code-free errors and
numeric-only digests.

<!-- NEXT_JS_LLM -->
2026-08-21 22:45:12 +02:00
Hendrik Liebau d2e6b6c0e4 Preserve __NEXT_ERROR_CODE across the /_error page handoff (#93183)
When SSR fails in development — whether the failing page is in the App Router or the Pages Router — Next.js falls back to rendering the Pages Router `/_error` page and serializes the original error into `__NEXT_DATA__.err`. The client bootstrap in `packages/next/src/client/ index.tsx` later re-throws a fresh `new Error(initialErr.message)` so that the dev overlay picks it up. The error-code SWC plugin stamps that new `Error` with the generic code mapped to `%s` in `errors.json` because the message argument is an identifier, not a statically-known string, which is how the overlay ended up showing the wrong code for errors like `UseCacheTimeoutError`.

The pipeline has two problems on the way to the overlay. First, `errorToJSON` in `packages/next/src/server/render.tsx` only copies the error's standard fields (`name`, `source`, `message`, `stack`, `digest`) into `__NEXT_DATA__.err`, so the real `__NEXT_ERROR_CODE` attached to the thrown error never reaches the client. Second, the subsequent rewrap in `getServerError` at `packages/next/src/server/dev/node-stack- frames.ts` creates yet another `new Error(...)` that the plugin stamps with the same generic code, clobbering anything the caller might have set on the rewrapped instance.

This change plumbs the code through. `errorToJSON` now also emits `__NEXT_ERROR_CODE` using `extractNextErrorCode` so the value survives JSON serialization into `__NEXT_DATA__.err`; the type in `packages/next/src/shared/lib/utils.ts` is updated to match. Both rewrap sites — the client bootstrap and `getServerError` — copy the code from the source error onto the fresh `Error` via `Object.defineProperty` with `enumerable: false` and `configurable: true`, matching how the plugin itself stores the property, which overrides the generic code the plugin stamped on the rewrapped instance. The `use-cache-hanging` e2e test snapshot is updated from `E394` to `E236` now that the real code surfaces in the dev overlay.
2026-04-27 18:53:19 +02:00
Sebastian "Sebbie" Silbermann 7d98e0b534 [test] Include error code in Redbox snapshot (#90497) 2026-02-26 11:01:25 +00:00
Sebastian "Sebbie" Silbermann 382b79bcc9 [sourcemaps] Consistent cursor columns (#81375)
Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
2025-07-16 20:45:34 +02:00
Sebastian "Sebbie" Silbermann 8ea7d4bb35 [dev-overlay] Move error.name to label (#78198) 2025-04-25 11:00:58 +02:00
Sebastian "Sebbie" Silbermann b9d65b8afe [test] Assert on all errors in Redbox matchers (#77907) 2025-04-10 10:00:42 +02:00
Tim Neutkens 8040cf8728 Turbopack build: Fix urlencoding test (#77622)
### What?
- Added additional debug logging for `customRoutes`,
`publicFolderItems`, and `nextStaticFolderItems` in the filesystem
router utils
- Improved the dynamic route interpolation test to check all script
sources instead of just the first matching one
- Fixed the Turbopack build test manifest to correctly mark the dynamic
route interpolation test as passing
- Updated the `to_string()` implementation in `ServerFileSystem` to use
a hyphenated format so that it behaves the same between urlencoded and
urldecoded.

### Why?

This PR improves debugging capabilities for the filesystem router and
fixes the dynamic route interpolation test to be more robust by checking
all script sources rather than just the first one that matches certain
criteria. The test now properly verifies that both encoded and decoded
paths work correctly.

### How?
- Added debug statements for additional route-related variables
- Refactored the test to collect all script sources and verify each one
works with both encoded and decoded paths
- Updated the Turbopack test manifest to reflect the fixed test
- Changed the server filesystem string representation to use hyphens
instead of spaces
2025-03-31 10:40:14 +02:00
Sebastian "Sebbie" Silbermann df77469085 [test] Use new Redbox matchers in server-navigation-error (#76787) 2025-03-04 11:50:26 +01:00
Sebastian "Sebbie" Silbermann afa34e9334 [dev-overlay] Fix off-by-one column sourcemapping in Webpack (#76152) 2025-02-18 20:39:55 +01:00
Sebastian "Sebbie" Silbermann 848c22977b Stop sourcemapping function names (#74085) 2024-12-19 20:54:35 +01:00
Jiachi Liu 664d888f9e Error on navigation API usage in pages router and middleware (#73100) 2024-11-27 17:00:00 +01:00