Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcemap errors in terminal by default #71444

Merged

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Oct 17, 2024

Requires experimental.serverSourceMaps.

When an error is logged (e.g. console.error(error)), we'll now display the stack sourcemapped and include a sourceframe. We already do this with a couple of errors but now we'll do it consistently.

For

export default function Page() {
  const error = new Error("Boom!");
  console.error(error);
  return null;
}

Node.js terminal:

Error: Boom
    at Page (webpack-internal:///(rsc)/./app/page.tsx:6:19)
    at react-stack-bottom-frame (webpack-internal:///(react-server)/./dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js:3558:20)
[...]
Boom
    at Page (webpack:///app/page.tsx?7603:2:16)

Node.js --inspect (no changes):

CleanShot 2024-10-22 at 20 11 57

Browser (no changes):
CleanShot 2024-10-22 at 20 12 46

Follow-up:

  • --enable-source-maps by default whenexperimental.serverSourceMaps: true (does this cause a noticeably slower next-build?)
  • replace logErrorWithOriginalStack with console.error in setup-dev-bundler
  • ship experimental.serverSourceMaps (probably need to consider security. Might be easier to split into build-only server sourcemaps which is the critical part of this work or just create sourcemaps during build that we ensure are not part of the deploy)
  • get rid of webpack:// prefixing via https://webpack.js.org/configuration/output/#outputdevtoolmodulefilenametemplate to that locations are clickable

Copy link
Member Author

eps1lon commented Oct 17, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @eps1lon and the rest of your teammates on Graphite Graphite

@eps1lon eps1lon changed the title Sourcemap terminal errors by default in next dev [unfinished] Sourcemap terminal errors by default in next dev Oct 17, 2024
@eps1lon eps1lon force-pushed the sebbie/10-17-improve_type_coverage_of_setup-dev-bundler branch from 566d0b1 to 4b50611 Compare October 17, 2024 21:13
Base automatically changed from sebbie/10-17-improve_type_coverage_of_setup-dev-bundler to canary October 22, 2024 17:59
@eps1lon eps1lon force-pushed the sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ branch from dd28cf9 to 391d4c2 Compare October 22, 2024 18:03
@ijjk
Copy link
Member

ijjk commented Oct 22, 2024

Failing test suites

Commit: 1513e5b

pnpm test test/integration/edge-runtime-module-errors/test/module-imports.test.js

  • Edge runtime code with imports > Edge API statically importing node.js module > throws unsupported module error in dev at runtime and highlights the faulty line
Expand output

● Edge runtime code with imports › Edge API statically importing node.js module › throws unsupported module error in dev at runtime and highlights the faulty line

expect(received).toBe(expected) // Object.is equality

Expected: 500
Received: 404

  88 |       await retry(async () => {
  89 |         const res = await fetchViaHTTP(context.appPort, url)
> 90 |         expect(res.status).toBe(500)
     |                            ^
  91 |         const text = await res.text()
  92 |         expectUnsupportedModuleDevError(moduleName, importStatement, text)
  93 |       })

  at toBe (integration/edge-runtime-module-errors/test/module-imports.test.js:90:28)
  at retry (lib/next-test-utils.ts:806:14)
  at Object.<anonymous> (integration/edge-runtime-module-errors/test/module-imports.test.js:88:7)

Read more about building and testing Next.js in contributing.md.

@ijjk
Copy link
Member

ijjk commented Oct 22, 2024

Stats from current PR

Default Build (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ Change
buildDuration 18.6s 23s ⚠️ +4.4s
buildDurationCached 15.3s 13.9s N/A
nodeModulesSize 374 MB 402 MB ⚠️ +28.6 MB
nextStartRea..uration (ms) 432ms 471ms N/A
Client Bundles (main, webpack)
vercel/next.js canary vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ Change
4172-HASH.js gzip 45.2 kB 45 kB N/A
4265-HASH.js gzip 5.27 kB 5.26 kB N/A
7ac8fc69-HASH.js gzip 52.6 kB 52.6 kB N/A
9045.HASH.js gzip 169 B 169 B
framework-HASH.js gzip 57.4 kB 57.4 kB N/A
main-app-HASH.js gzip 233 B 233 B
main-HASH.js gzip 33 kB 32.9 kB N/A
webpack-HASH.js gzip 1.71 kB 1.71 kB
Overall change 2.11 kB 2.11 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB
Overall change 39.4 kB 39.4 kB
Client Pages
vercel/next.js canary vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ Change
_app-HASH.js gzip 192 B 192 B
_error-HASH.js gzip 192 B 191 B N/A
amp-HASH.js gzip 506 B 512 B N/A
css-HASH.js gzip 343 B 342 B N/A
dynamic-HASH.js gzip 1.84 kB 1.85 kB N/A
edge-ssr-HASH.js gzip 265 B 266 B N/A
head-HASH.js gzip 364 B 364 B
hooks-HASH.js gzip 392 B 392 B
image-HASH.js gzip 4.41 kB 4.41 kB N/A
index-HASH.js gzip 268 B 268 B
link-HASH.js gzip 2.78 kB 2.78 kB N/A
routerDirect..HASH.js gzip 327 B 327 B
script-HASH.js gzip 397 B 396 B N/A
withRouter-HASH.js gzip 321 B 324 B N/A
1afbb74e6ecf..834.css gzip 106 B 106 B
Overall change 1.65 kB 1.65 kB
Client Build Manifests
vercel/next.js canary vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ Change
_buildManifest.js gzip 751 B 749 B N/A
Overall change 0 B 0 B
Rendered Page Sizes
vercel/next.js canary vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ Change
index.html gzip 522 B 523 B N/A
link.html gzip 537 B 536 B N/A
withRouter.html gzip 518 B 519 B N/A
Overall change 0 B 0 B
Edge SSR bundle Size
vercel/next.js canary vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ Change
edge-ssr.js gzip 128 kB 128 kB N/A
page.js gzip 188 kB 187 kB N/A
Overall change 0 B 0 B
Middleware size
vercel/next.js canary vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ Change
middleware-b..fest.js gzip 667 B 668 B N/A
middleware-r..fest.js gzip 155 B 156 B N/A
middleware.js gzip 31 kB 31 kB N/A
edge-runtime..pack.js gzip 844 B 844 B
Overall change 844 B 844 B
Next Runtimes Overall increase ⚠️
vercel/next.js canary vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ Change
973-experime...dev.js gzip 322 B 322 B
973.runtime.dev.js gzip 314 B 314 B
app-page-exp...dev.js gzip 317 kB 317 kB N/A
app-page-exp..prod.js gzip 121 kB 121 kB N/A
app-page-tur..prod.js gzip 134 kB 134 kB N/A
app-page-tur..prod.js gzip 129 kB 129 kB N/A
app-page.run...dev.js gzip 308 kB 308 kB N/A
app-page.run..prod.js gzip 117 kB 117 kB N/A
app-route-ex...dev.js gzip 35.9 kB 35.9 kB N/A
app-route-ex..prod.js gzip 24.4 kB 24.4 kB N/A
app-route-tu..prod.js gzip 24.4 kB 24.4 kB N/A
app-route-tu..prod.js gzip 24.2 kB 24.2 kB N/A
app-route.ru...dev.js gzip 37.6 kB 37.5 kB N/A
app-route.ru..prod.js gzip 24.2 kB 24.2 kB N/A
pages-api-tu..prod.js gzip 9.61 kB 9.61 kB
pages-api.ru...dev.js gzip 11.4 kB 11.4 kB
pages-api.ru..prod.js gzip 9.61 kB 9.61 kB
pages-turbo...prod.js gzip 20.9 kB 20.9 kB
pages.runtim...dev.js gzip 26.5 kB 26.5 kB
pages.runtim..prod.js gzip 20.9 kB 20.9 kB
server.runti..prod.js gzip 58.4 kB 914 kB ⚠️ +855 kB
Overall change 158 kB 1.01 MB ⚠️ +855 kB
build cache
vercel/next.js canary vercel/next.js sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ Change
0.pack gzip 1.85 MB 1.85 MB N/A
index.pack gzip 143 kB 143 kB N/A
Overall change 0 B 0 B
Diff details
Diff for page.js

Diff too large to display

Diff for middleware.js

Diff too large to display

Diff for edge-ssr.js

Diff too large to display

Diff for image-HASH.js
@@ -1,7 +1,7 @@
 (self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([
   [8358],
   {
-    /***/ 4693: /***/ (
+    /***/ 7494: /***/ (
       __unused_webpack_module,
       __unused_webpack_exports,
       __webpack_require__
@@ -9,7 +9,7 @@
       (window.__NEXT_P = window.__NEXT_P || []).push([
         "/image",
         function () {
-          return __webpack_require__(8698);
+          return __webpack_require__(9269);
         },
       ]);
       if (false) {
@@ -18,7 +18,7 @@
       /***/
     },
 
-    /***/ 5928: /***/ (module, exports, __webpack_require__) => {
+    /***/ 245: /***/ (module, exports, __webpack_require__) => {
       "use strict";
       /* __next_internal_client_entry_do_not_use__  cjs */
       Object.defineProperty(exports, "__esModule", {
@@ -40,17 +40,17 @@
         __webpack_require__(1150)
       );
       const _head = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(2614)
+        __webpack_require__(6936)
       );
-      const _getimgprops = __webpack_require__(8958);
-      const _imageconfig = __webpack_require__(1533);
-      const _imageconfigcontextsharedruntime = __webpack_require__(2437);
-      const _warnonce = __webpack_require__(9124);
-      const _routercontextsharedruntime = __webpack_require__(5778);
+      const _getimgprops = __webpack_require__(1096);
+      const _imageconfig = __webpack_require__(8965);
+      const _imageconfigcontextsharedruntime = __webpack_require__(5280);
+      const _warnonce = __webpack_require__(857);
+      const _routercontextsharedruntime = __webpack_require__(9684);
       const _imageloader = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(406)
+        __webpack_require__(2448)
       );
-      const _usemergedref = __webpack_require__(9782);
+      const _usemergedref = __webpack_require__(5493);
       // This is replaced by webpack define plugin
       const configEnv = {
         deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
@@ -371,7 +371,7 @@
       /***/
     },
 
-    /***/ 9782: /***/ (module, exports, __webpack_require__) => {
+    /***/ 5493: /***/ (module, exports, __webpack_require__) => {
       "use strict";
 
       Object.defineProperty(exports, "__esModule", {
@@ -432,7 +432,7 @@
       /***/
     },
 
-    /***/ 8958: /***/ (
+    /***/ 1096: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -448,9 +448,9 @@
           return getImgProps;
         },
       });
-      const _warnonce = __webpack_require__(9124);
-      const _imageblursvg = __webpack_require__(9846);
-      const _imageconfig = __webpack_require__(1533);
+      const _warnonce = __webpack_require__(857);
+      const _imageblursvg = __webpack_require__(5681);
+      const _imageconfig = __webpack_require__(8965);
       const VALID_LOADING_VALUES =
         /* unused pure expression or super */ null && [
           "lazy",
@@ -824,7 +824,7 @@
       /***/
     },
 
-    /***/ 9846: /***/ (__unused_webpack_module, exports) => {
+    /***/ 5681: /***/ (__unused_webpack_module, exports) => {
       "use strict";
       /**
        * A shared function, used on both client and server, to generate a SVG blur placeholder.
@@ -879,7 +879,7 @@
       /***/
     },
 
-    /***/ 4951: /***/ (
+    /***/ 7398: /***/ (
       __unused_webpack_module,
       exports,
       __webpack_require__
@@ -906,10 +906,10 @@
         },
       });
       const _interop_require_default = __webpack_require__(9608);
-      const _getimgprops = __webpack_require__(8958);
-      const _imagecomponent = __webpack_require__(5928);
+      const _getimgprops = __webpack_require__(1096);
+      const _imagecomponent = __webpack_require__(245);
       const _imageloader = /*#__PURE__*/ _interop_require_default._(
-        __webpack_require__(406)
+        __webpack_require__(2448)
       );
       function getImageProps(imgProps) {
         const { props } = (0, _getimgprops.getImgProps)(imgProps, {
@@ -941,7 +941,7 @@
       /***/
     },
 
-    /***/ 406: /***/ (__unused_webpack_module, exports) => {
+    /***/ 2448: /***/ (__unused_webpack_module, exports) => {
       "use strict";
 
       Object.defineProperty(exports, "__esModule", {
@@ -976,7 +976,7 @@
       /***/
     },
 
-    /***/ 8698: /***/ (
+    /***/ 9269: /***/ (
       __unused_webpack_module,
       __webpack_exports__,
       __webpack_require__
@@ -993,8 +993,8 @@
 
       // EXTERNAL MODULE: ./node_modules/.pnpm/[email protected]/node_modules/react/jsx-runtime.js
       var jsx_runtime = __webpack_require__(1882);
-      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+main-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-28668d39-20241023_re_wbsj4g46sbkzmyvf32u2ztx36m/node_modules/next/image.js
-      var next_image = __webpack_require__(477);
+      // EXTERNAL MODULE: ./node_modules/.pnpm/next@file+..+diff-repo+packages+next+next-packed.tgz_react-dom@19.0.0-rc-28668d39-20241023_re_ygc4u4zbyids6gylg2elop7bza/node_modules/next/image.js
+      var next_image = __webpack_require__(8797);
       var image_default = /*#__PURE__*/ __webpack_require__.n(next_image); // CONCATENATED MODULE: ./pages/nextjs.png
       /* harmony default export */ const nextjs = {
         src: "/_next/static/media/nextjs.cae0b805.png",
@@ -1024,12 +1024,12 @@
       /***/
     },
 
-    /***/ 477: /***/ (
+    /***/ 8797: /***/ (
       module,
       __unused_webpack_exports,
       __webpack_require__
     ) => {
-      module.exports = __webpack_require__(4951);
+      module.exports = __webpack_require__(7398);
 
       /***/
     },
@@ -1039,7 +1039,7 @@
     /******/ var __webpack_exec__ = (moduleId) =>
       __webpack_require__((__webpack_require__.s = moduleId));
     /******/ __webpack_require__.O(0, [2888, 9774, 179], () =>
-      __webpack_exec__(4693)
+      __webpack_exec__(7494)
     );
     /******/ var __webpack_exports__ = __webpack_require__.O();
     /******/ _N_E = __webpack_exports__;
Diff for 4172-HASH.js

Diff too large to display

Diff for main-HASH.js

Diff too large to display

Diff for app-page-exp..ntime.dev.js
failed to diff
Diff for app-page-exp..time.prod.js

Diff too large to display

Diff for app-page-tur..time.prod.js

Diff too large to display

Diff for app-page-tur..time.prod.js

Diff too large to display

Diff for app-page.runtime.dev.js
failed to diff
Diff for app-page.runtime.prod.js

Diff too large to display

Diff for app-route-ex..ntime.dev.js

Diff too large to display

Diff for app-route-ex..time.prod.js

Diff too large to display

Diff for app-route-tu..time.prod.js

Diff too large to display

Diff for app-route-tu..time.prod.js

Diff too large to display

Diff for app-route.runtime.dev.js

Diff too large to display

Diff for app-route.ru..time.prod.js

Diff too large to display

Diff for server.runtime.prod.js
failed to diff
Commit: 1513e5b

package.json Outdated
@@ -52,6 +52,7 @@
"lint-staged": "lint-staged",
"next-with-deps": "./scripts/next-with-deps.sh",
"next": "cross-env NEXT_TELEMETRY_DISABLED=1 node --trace-deprecation --enable-source-maps packages/next/dist/bin/next",
"next-inspect": "cross-env NEXT_TELEMETRY_DISABLED=1 node --trace-deprecation --enable-source-maps --inspect packages/next/dist/bin/next",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably just merge this into debug?

Comment on lines +1 to +3
import { patchErrorInspect } from '../patch-error-inspect'

patchErrorInspect()
Copy link
Member Author

@eps1lon eps1lon Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemingly unnecessary indirection but I went back and forth when to patch and if the patch needs arguments. Keeping the indirection for development for now.

import { parseStack } from '../client/components/react-dev-overlay/server/middleware'
import { getOriginalCodeFrame } from '../client/components/react-dev-overlay/server/shared'

// TODO: Implement for Edge runtime
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also for me to test how this works in our Edge sandbox.

@eps1lon eps1lon changed the title [unfinished] Sourcemap terminal errors by default in next dev [unfinished] Sourcemap terminal errors by default Oct 22, 2024
Comment on lines +5 to +6
import { parseStack } from '../client/components/react-dev-overlay/server/middleware'
import { getOriginalCodeFrame } from '../client/components/react-dev-overlay/server/shared'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these to a more appropriate place. These modules are not used on the Client.

idx = unparsedStack.lastIndexOf('\n', idx)
}
if (idx !== -1) {
// Cut off everything after the bottom frame since it'll be React internals.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this just go through ignore listing? Mainly because I think we want an option to disable ignore listing in the terminal in case you encounter Next.js/React bugs.

Comment on lines +192 to +222
depth:
(inspectOptions.depth ??
// Default in Node.js
2) - depth,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we wouldn't respect the max depth, if we'd just forward all options. Haven't tested though.

@eps1lon eps1lon changed the title [unfinished] Sourcemap terminal errors by default [unfinished] Sourcemap errors in terminal by default Oct 22, 2024
@@ -0,0 +1,201 @@
import { findSourceMap } from 'module'
import type * as util from 'util'
import { SourceMapConsumer as SyncSourceMapConsumer } from 'next/dist/compiled/source-map'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an older version of source-map that's still sync (mozilla/source-map#331). Consider moving to https://www.npmjs.com/package/@cspotcode/source-map-consumer

import { parseStack } from '../client/components/react-dev-overlay/server/middleware'
import { getOriginalCodeFrame } from '../client/components/react-dev-overlay/server/shared'

// TODO: Implement for Edge runtime
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also test with Bun.

@eps1lon eps1lon force-pushed the sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ branch from 391d4c2 to 0126477 Compare October 22, 2024 19:35
@eps1lon eps1lon changed the base branch from canary to sebbie/10-22-enable_source_maps_for_pnpm_debug_ October 22, 2024 19:35
Base automatically changed from sebbie/10-22-enable_source_maps_for_pnpm_debug_ to canary October 22, 2024 20:13
@eps1lon eps1lon force-pushed the sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ branch from 0126477 to 3358d1e Compare October 23, 2024 16:48
@@ -27,6 +27,7 @@ describe(`Dynamic IO Prospective Fallback`, () => {
// we expect the build to fail
}

// TODO: Assert on component stack
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change:

Error: In Route "/blog/[slug]" this component accessed data without a fallback UI available somewhere above it using Suspense.
    at E (webpack:///src/client/components/layout-router.tsx:324:3)
    at c (webpack:///src/client/components/redirect-boundary.tsx:48:5)
    at l (webpack:///src/client/components/redirect-boundary.tsx:78:34)
    at l (webpack:///src/client/components/not-found-boundary.tsx:119:3)
    at O (webpack:///src/client/components/layout-router.tsx:466:3)
    at ErrorBoundary (webpack:///src/client/components/error-boundary.tsx:190:3)
    at P (webpack:///src/client/components/layout-router.tsx:289:3)
    at S (webpack:///src/client/components/layout-router.tsx:299:9)
    at RenderFromTemplateContext (webpack:///src/client/components/render-from-template-context.tsx:8:10)
    at R (webpack:///src/client/components/layout-router.tsx:514:9)
    at E (webpack:///src/client/components/layout-router.tsx:324:3)
    at c (webpack:///src/client/components/redirect-boundary.tsx:48:5)
    at l (webpack:///src/client/components/redirect-boundary.tsx:78:34)
    at l (webpack:///src/client/components/not-found-boundary.tsx:119:3)
    at O (webpack:///src/client/components/layout-router.tsx:466:3)
    at ErrorBoundary (webpack:///src/client/components/error-boundary.tsx:190:3)
    at P (webpack:///src/client/components/layout-router.tsx:289:3)
    at S (webpack:///src/client/components/layout-router.tsx:299:9)
    at RenderFromTemplateContext (webpack:///src/client/components/render-from-template-context.tsx:8:10)
    at R (webpack:///src/client/components/layout-router.tsx:514:9)
    at E (webpack:///src/client/components/layout-router.tsx:324:3)
    at c (webpack:///src/client/components/redirect-boundary.tsx:48:5)
    at l (webpack:///src/client/components/redirect-boundary.tsx:78:34)
    at c (webpack:///src/client/components/not-found-boundary.tsx:33:5)
    at l (webpack:///src/client/components/not-found-boundary.tsx:119:3)
    at O (webpack:///src/client/components/layout-router.tsx:466:3)
    at ErrorBoundary (webpack:///src/client/components/error-boundary.tsx:190:3)
    at P (webpack:///src/client/components/layout-router.tsx:289:3)
    at S (webpack:///src/client/components/layout-router.tsx:299:9)
    at RenderFromTemplateContext (webpack:///src/client/components/render-from-template-context.tsx:8:10)
    at R (webpack:///src/client/components/layout-router.tsx:514:9)
    at body (<anonymous>)
    at html (<anonymous>)
    at constructor (webpack://next/dist/src/client/components/redirect-boundary.tsx?07a0:48:5)
    at splitInterceptingRoute (webpack://next/dist/src/client/components/redirect-boundary.tsx?07a0:79:9)
    at splitInterceptingRoute (webpack://next/dist/src/client/components/app-router.tsx?b068:215:9)
    at constructor (webpack://next/dist/src/client/components/error-boundary.tsx?ce04:69:11)
    at errorComponent (webpack://next/dist/src/client/components/error-boundary.tsx?ce04:190:3)
    at actionQueue (webpack://next/dist/src/client/components/app-router.tsx?b068:632:3)
    at ServerInsertedHTMLProvider (webpack://next/dist/src/server/app-render/server-inserted-html.tsx?7790:14:34)
    at splitInterceptingRoute (webpack://next/dist/src/server/app-render/app-render.tsx?93c3:836:3)

Follow-up:

  • remove webpack:// prefix
  • Find out why names are not sourcemapped and still minified
  • no useful component stack. I would've expected the component that accessed the data to show up here?

@eps1lon eps1lon changed the title [unfinished] Sourcemap errors in terminal by default Sourcemap errors in terminal by default Oct 23, 2024
@eps1lon eps1lon force-pushed the sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ branch from 3358d1e to e5624b5 Compare October 23, 2024 17:30
Comment on lines +22 to +24
// TODO: Node.js seems to use a different algorithm
// class ReadonlyRequestCookiesError extends Error {}` would read `ReadonlyRequestCookiesError: [...]`
// in the stack i.e. seems like under certain conditions it favors the constructor name.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eps1lon eps1lon force-pushed the sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ branch from 6bfa08b to cd19097 Compare October 23, 2024 19:36
@eps1lon eps1lon force-pushed the sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ branch 2 times, most recently from 69fed41 to 336ac6a Compare October 23, 2024 21:57
@eps1lon eps1lon marked this pull request as ready for review October 23, 2024 22:02
@eps1lon eps1lon force-pushed the sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ branch from 336ac6a to 1513e5b Compare October 24, 2024 09:22
Comment on lines +7 to +9
// Deploy tests don't have access to runtime logs.
// Manually verify that the runtime logs match.
skipDeployment: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eps1lon
Copy link
Member Author

eps1lon commented Oct 24, 2024

Flaky test. Merging anyway.

@eps1lon eps1lon merged commit af6f6aa into canary Oct 24, 2024
106 of 108 checks passed
@eps1lon eps1lon deleted the sebbie/10-17-sourcemap_terminal_errors_by_default_in_next_dev_ branch October 24, 2024 13:11
@eps1lon
Copy link
Member Author

eps1lon commented Oct 25, 2024

Need to revert since source-map uses Math.random for quick-sort which triggers warnings with experimental.dynamicIO: #71868

eps1lon added a commit that referenced this pull request Oct 25, 2024
eps1lon added a commit that referenced this pull request Oct 25, 2024
renovate bot added a commit to mmkal/eslint-plugin-mmkal that referenced this pull request Oct 29, 2024
##### [v15.0.2](https://github.com/vercel/next.js/releases/tag/v15.0.2)

##### Core Changes

-   Read page name from work store in server module map proxy: [#71669](vercel/next.js#71669)
-   codemod: should not transform when param is not used: [#71664](vercel/next.js#71664)
-   \[dynamicIO] complete refactor to prerender: [#71687](vercel/next.js#71687)
-   fix: metadata image route normalize path posix for windows: [#71673](vercel/next.js#71673)
-   next-codemod(upgrade): optional catch when missing dev script: [#71598](vercel/next.js#71598)
-   Avoid server action function indirection in Turbopack: [#71628](vercel/next.js#71628)
-   fix: exclude `basePath` in `findSourceMapURL`: [#71719](vercel/next.js#71719)
-   fix: stack frame text color in dark mode: [#71656](vercel/next.js#71656)
-   Fix: revert the bad node binary handling: [#71723](vercel/next.js#71723)
-   next-codemod: add empty `pnpm-workspace.yaml` to test fixtures to bypass PNPM workspace checks: [#71726](vercel/next.js#71726)
-   warn on sync access if dynamicIO is not enabled: [#71696](vercel/next.js#71696)
-   Update React from `69d4b800-20241021` to `45804af1-20241021`: [#71718](vercel/next.js#71718)
-   next-upgrade: do not add `--turbopack` flag when `--turbo` exists in `next dev`: [#71730](vercel/next.js#71730)
-   feat: stitch errors with react owner stack: [#70393](vercel/next.js#70393)
-   \[dynamicIO] update data access error and documentation: [#71738](vercel/next.js#71738)
-   Test cached form action with revalidate: [#71591](vercel/next.js#71591)
-   Upgrade React from `45804af1-20241021` to `28668d39-20241023`: [#71745](vercel/next.js#71745)
-   Fix race condition when setting client reference manifests: [#71741](vercel/next.js#71741)
-   Fix fetch with no-store inside of use cache: [#71754](vercel/next.js#71754)
-   Remove the bottom collapse button in dev overlay: [#71658](vercel/next.js#71658)
-   \[dynamicIO] unify cache filling and lazy-module warming: [#71749](vercel/next.js#71749)
-   Don't filter out <anonymous> source location frames through RSC: [#71752](vercel/next.js#71752)
-   fix undefined default export error msg: [#71762](vercel/next.js#71762)
-   Upgrade React from `28668d39-20241023` to `1631855f-20241023`: [#71769](vercel/next.js#71769)
-   Enable owner stack in experimental build: [#71716](vercel/next.js#71716)
-   feat: add experiment for sharpjs cpu flags: [#71733](vercel/next.js#71733)
-   fix: handle server component replay error in error overlay: [#71772](vercel/next.js#71772)
-   Don't error asking for prebuilt bundles: [#71778](vercel/next.js#71778)
-   Replace `turbopack://[project]/...` sourcemap uris with `file://...` in development: [#71489](vercel/next.js#71489)
-   misc: update source map paths for bundled Next.js runtime: [#71779](vercel/next.js#71779)
-   \[dynamicIO] refine error message and docs: [#71781](vercel/next.js#71781)
-   next-upgrade: change `--turbo` to `--turbopack` if applicable: [#71737](vercel/next.js#71737)
-   Show all diff when uncollapse: [#71792](vercel/next.js#71792)
-   Sourcemap errors in terminal by default : [#71444](vercel/next.js#71444)
-   Fully enable custom error callbacks for app router: [#71794](vercel/next.js#71794)
-   Simplify Server Action Webpack plugin: [#71721](vercel/next.js#71721)
-   ensure DIO development segment errors are cleared after correcting: [#71811](vercel/next.js#71811)
-   Include sourceframe in errors logged in the terminal during development: [#71803](vercel/next.js#71803)
-   \[dynamicIO] update prerender cache scoping and cache warming for validation: [#71822](vercel/next.js#71822)
-   only force stack frame color in tty: [#71860](vercel/next.js#71860)
-   Add test for fetch with auth in use cache: [#71768](vercel/next.js#71768)
-   Fix race with hot-reloader-client clearing overlay errors: [#71771](vercel/next.js#71771)
-   Fix dynamic tracking in dev: [#71867](vercel/next.js#71867)
-   Revert "Sourcemap errors in terminal by default ([#71444](vercel/next.js#71444))": [#71868](vercel/next.js#71868)
-   Fix fetch caching inside of `"use cache"`: [#71793](vercel/next.js#71793)
-   Trace upload: only send traces for current session: [#71838](vercel/next.js#71838)
-   Reland "Sourcemap errors in terminal by default": [#71877](vercel/next.js#71877)
-   Implement information byte in Server Reference ID and other optimizations: [#71463](vercel/next.js#71463)
-   fix: webpack build error on Windows: [#71943](vercel/next.js#71943)
-   Run with `--enable-source-maps` by default in `next dev`: [#71820](vercel/next.js#71820)
-   fix global-error styles: [#71914](vercel/next.js#71914)
-   Use `registerClientReference` for ESM client component modules: [#71968](vercel/next.js#71968)
-   Fix missing `await` of `params` when metadata is used with an image file: [#71871](vercel/next.js#71871)
-   Upgrade React from `1631855f-20241023` to `02c0e824-20241028`: [#71979](vercel/next.js#71979)
-   Populate sourcemap `ignoreList` when Webpack is used: [#71821](vercel/next.js#71821)
-   \[dynamicIO] unify server and client prerender for non-ppr pathway: [#71764](vercel/next.js#71764)
-   codemod: add separator to the parenthenese expr: [#71993](vercel/next.js#71993)
-   Respect sourcemap's ignore list when printing errors in the terminal: [#71908](vercel/next.js#71908)
-   fix console color to be compatible in chrome devtools: [#71939](vercel/next.js#71939)
-   Delete obsolete codemod `next-dynamic-access-named-export`: [#72016](vercel/next.js#72016)
-   fix: log the error instance modified extra location info: [#71930](vercel/next.js#71930)
-   Compare error stack to dedupe error: [#71798](vercel/next.js#71798)

##### Example Changes

-   experimental.instrumentationHook is not necessary anymore: [#71808](vercel/next.js#71808)
-   Add Jude to nextjs team: [#71936](vercel/next.js#71936)

##### Misc Changes

-   docs: fix broken link in Architecture/Turbopack documentation: [#71412](vercel/next.js#71412)
-   test: migrate rest async api usage in tests: [#71663](vercel/next.js#71663)
-   fix: docs for dynamic routing in next 15: [#71531](vercel/next.js#71531)
-   Remove the 'new' keyword from the GET function sample code.: [#71671](vercel/next.js#71671)
-   chore: fix wrong path of comments: [#71682](vercel/next.js#71682)
-   docs(next-config): remove mention of appIsrStatus is on canary: [#71695](vercel/next.js#71695)
-   react-sync: Ignore update notices from npm: [#71717](vercel/next.js#71717)
-   Docs: Update default marker for fetch cache option: [#71728](vercel/next.js#71728)
-   \[docs] Fix page.tsx parameter types: [#71680](vercel/next.js#71680)
-   \[docs] Fix table.js containing TS code: [#71677](vercel/next.js#71677)
-   docs(ppr): update note about ppr: [#71697](vercel/next.js#71697)
-   docs lint: [#71748](vercel/next.js#71748)
-   fixes error message asserts and lints: [#71747](vercel/next.js#71747)
-   Fix docs for configuring Turbopack: [#71755](vercel/next.js#71755)
-   docs(turbo): add experimental icon to turbo config section: [#71761](vercel/next.js#71761)
-   feat(turbopack): Add `__turbopack_original__` while tree shaking: [#71547](vercel/next.js#71547)
-   test: re-enable test with note: [#71789](vercel/next.js#71789)
-   Docs: Remove beta marker from Turbopack docs: [#71796](vercel/next.js#71796)
-   Update docs 1: [#71812](vercel/next.js#71812)
-   docs lint fixes: [#71813](vercel/next.js#71813)
-   docs: remove `"use cache"` on before code snippet: [#71815](vercel/next.js#71815)
-   Next docs broken links: [#71823](vercel/next.js#71823)
-   \[Turbopack] add optimization based on upper count: [#71606](vercel/next.js#71606)
-   chore(turbo-tasks-backend): Use let instead of match for macro bindings: [#71756](vercel/next.js#71756)
-   chore(turbo-tasks-backend): Remove collapsible-if lints: [#71758](vercel/next.js#71758)
-   removing extra reference: [#71853](vercel/next.js#71853)
-   codemod(turbopack): Rewrite Vc fields in structs as ResolvedVc (part 3): [#71665](vercel/next.js#71665)
-   Update sync-dynamic-apis.mdx: [#71907](vercel/next.js#71907)
-   codemod(turbopack): Rewrite Vc fields in structs as ResolvedVc (part 4): [#71804](vercel/next.js#71804)
-   test: remove duplicated flaky test: [#71967](vercel/next.js#71967)
-   docs: Fix typo in cacheLife configs in use-cache docs: [#71921](vercel/next.js#71921)
-   Fix use cache example line highlights: [#71883](vercel/next.js#71883)
-   Allow breakpoints to be set in `packages/next/src/compiled`: [#71986](vercel/next.js#71986)
-   updated upgrade to v15 command in docs: [#71643](vercel/next.js#71643)
-   codemod(turbopack): Rewrite Vc fields in structs as ResolvedVc (part 5): [#71861](vercel/next.js#71861)
-   Clarify that streaming is blocked on generateMetadata for initial load: [#71985](vercel/next.js#71985)
-   Docs: Add legacy tags: [#71964](vercel/next.js#71964)
-   Docs: Fix broken link: [#72021](vercel/next.js#72021)
-   (docs) `use cache`: Add text code formatting: [#71999](vercel/next.js#71999)
-   docs: update file structure: [#71951](vercel/next.js#71951)
-   Documentation Fix: Correct `cacheTag` Function Usage: [#71912](vercel/next.js#71912)
-   correct expire calc & and Nested usage import in use-cache docs: [#71899](vercel/next.js#71899)
-   Docs: Address internal `use cache` comments : [#71981](vercel/next.js#71981)
-   Fix swc version mismatch when checking out an older version: [#71978](vercel/next.js#71978)

##### Credits

Huge thanks to [@ytori](https://github.com/ytori), [@unstubbable](https://github.com/unstubbable), [@huozhi](https://github.com/huozhi), [@SebassNoob](https://github.com/SebassNoob), [@tatsuteb](https://github.com/tatsuteb), [@Marukome0743](https://github.com/Marukome0743), [@gnoff](https://github.com/gnoff), [@samcx](https://github.com/samcx), [@devjiwonchoi](https://github.com/devjiwonchoi), [@imprakharshukla](https://github.com/imprakharshukla), [@migueldamota](https://github.com/migueldamota), [@eps1lon](https://github.com/eps1lon), [@ztanner](https://github.com/ztanner), [@timneutkens](https://github.com/timneutkens), [@cantemizyurek](https://github.com/cantemizyurek), [@sebmarkbage](https://github.com/sebmarkbage), [@padmaia](https://github.com/padmaia), [@ijjk](https://github.com/ijjk), [@styfle](https://github.com/styfle), [@wbinnssmith](https://github.com/wbinnssmith), [@feedthejim](https://github.com/feedthejim), [@kdy1](https://github.com/kdy1), [@shuding](https://github.com/shuding), [@molebox](https://github.com/molebox), [@ismaelrumzan](https://github.com/ismaelrumzan), [@sokra](https://github.com/sokra), [@bgw](https://github.com/bgw), [@timeyoutakeit](https://github.com/timeyoutakeit), [@AdonisAgelis](https://github.com/AdonisAgelis), [@chicoxyzzy](https://github.com/chicoxyzzy), [@gaojude](https://github.com/gaojude), [@elitalpa](https://github.com/elitalpa), [@t3dotgg](https://github.com/t3dotgg), [@gaearon](https://github.com/gaearon), [@nisabmohd](https://github.com/nisabmohd), [@gadcam](https://github.com/gadcam), [@delbaoliveira](https://github.com/delbaoliveira), [@bennettdams](https://github.com/bennettdams), [@wiscaksono](https://github.com/wiscaksono), and [@Developerayo](https://github.com/Developerayo) for helping!
stipsan pushed a commit to sanity-io/next.js that referenced this pull request Nov 6, 2024
stipsan pushed a commit to sanity-io/next.js that referenced this pull request Nov 6, 2024
@github-actions github-actions bot added the locked label Nov 9, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants