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

Ignore-list stack frames in node_modules even if not explicitly ignore-listed by their sourcemaps #73689

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Dec 9, 2024

We now ignore-list frames in node_modules when we can't sourcemap them (e.g. missing sourcemaps) and even if we can sourcemap but they're not ignore-listed.

Ignore-listing sourcemapped frames in node_modules may be controversial since it removes control from libraries. But right now it's more likely that ignoreList wasn't even filled since bundlers and transpilers don't enforce that configuration. In the future, we could start using an empty ignoreList as a signal that the frame really shouldn't be ignore-listed.

PR is split into current behavior and fix to make it easier to spot what actually changed.

Copy link
Member Author

eps1lon commented Dec 9, 2024

@eps1lon eps1lon changed the title Current behavior Ignore-list stack frames in node_modules even if not explicitly ignore-listed by their sourcemaps Dec 9, 2024
@ijjk
Copy link
Member

ijjk commented Dec 9, 2024

Failing test suites

Commit: 39ca37e

pnpm test test/integration/amp-export-validation/test/index.test.js

  • AMP Validation on Export > production mode > should have shown errors during build
Expand output

● AMP Validation on Export › production mode › should have shown errors during build

expect(received).toMatch(expected)

Expected pattern: /error.*The mandatory attribute 'height' is missing in tag 'amp-video'\./
Received string:  "   Loading config from /root/actions-runner/_work/next.js/next.js/test/integration/amp-export-validation/next.config.js
   Loading config from /root/actions-runner/_work/next.js/next.js/test/integration/amp-export-validation/next.config.js
   ▲ Next.js 15.0.4-canary.48·
   Checking validity of types ...
   Creating an optimized production build ...
   Loading config from /root/actions-runner/_work/next.js/next.js/test/integration/amp-export-validation/next.config.js
   Loading config from /root/actions-runner/_work/next.js/next.js/test/integration/amp-export-validation/next.config.js
   Loading config from /root/actions-runner/_work/next.js/next.js/test/integration/amp-export-validation/next.config.js
 ✓ Compiled successfully
   Collecting page data ...
   Generating static pages (0/8) ...
   Generating static pages (2/8)··
 ⚠ Linting is disabled.
Error occurred prerendering page \"/first\". Read more: https://nextjs.org/docs/messages/prerender-error
AssertionError: Assertion failed: WebAssembly is uninitialized

  at new module$contents$goog$asserts_AssertionError (../evalmachine.<anonymous>:102:1441)
  at module$contents$goog$asserts_doAssertFailure (../evalmachine.<anonymous>:103:354)
  at goog.asserts.assertExists (../evalmachine.<anonymous>:104:374)
  at Object.module$contents$amp$validator_validateString [as validateString] (../evalmachine.<anonymous>:2238:108)
  at Validator.validateString (../packages/next/dist/compiled/amphtml-validator/index.js:1:20650)
  at validateAmp (../packages/next/dist/export/routes/pages.js:100:34)
  at async exportPagesPage (../packages/next/dist/export/routes/pages.js:117:13)
  at async Span.traceAsyncFn (../packages/next/dist/trace/trace.js:153:20)
  at async exportPage (../packages/next/dist/export/worker.js:334:18)
  Export encountered an error on /first, exiting the build.
   ⨯ Static worker exited with code: 1 and signal: null
  "
  at Object.toMatch (integration/amp-export-validation/test/index.test.js:28:29)

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

pnpm test-dev test/development/acceptance/server-component-compiler-errors-in-pages.test.ts

  • Error Overlay for server components compiler errors in pages > importing 'server-only' in pages
  • Error Overlay for server components compiler errors in pages > importing after from 'next/server' in pages
Expand output

● Error Overlay for server components compiler errors in pages › importing 'server-only' in pages

Expected Redbox but found none

  101 |     )
  102 |
> 103 |     await session.assertHasRedbox()
      |     ^
  104 |     await expect(session.getRedboxSource()).resolves.toMatch(
  105 |       /That only works in a Server Component/
  106 |     )

  at Object.<anonymous> (development/acceptance/server-component-compiler-errors-in-pages.test.ts:103:5)

● Error Overlay for server components compiler errors in pages › importing after from 'next/server' in pages

Expected Redbox but found none

  159 |     )
  160 |
> 161 |     await session.assertHasRedbox()
      |     ^
  162 |     await expect(session.getRedboxSource()).resolves.toMatch(
  163 |       /That only works in a Server Component/
  164 |     )

  at Object.<anonymous> (development/acceptance/server-component-compiler-errors-in-pages.test.ts:161:5)

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

pnpm test-dev test/development/app-hmr/hmr.test.ts

  • app-dir-hmr > filesystem changes > should update server components after navigating to a page with a different runtime
Expand output

● app-dir-hmr › filesystem changes › should update server components after navigating to a page with a different runtime

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

Expected: "ipad"
Received: "mac"

  69 |
  70 |         await retry(async () => {
> 71 |           expect(await browser.elementByCss('p').text()).toBe('ipad')
     |                                                          ^
  72 |         })
  73 |
  74 |         const logs = await browser.log()

  at toBe (development/app-hmr/hmr.test.ts:71:58)
  at retry (lib/next-test-utils.ts:806:14)
  at development/app-hmr/hmr.test.ts:70:9
  at NextDevInstance.patchFile (lib/next-modes/base.ts:531:9)
  at NextDevInstance.patchFile (lib/next-modes/next-dev.ts:195:16)
  at Object.<anonymous> (development/app-hmr/hmr.test.ts:67:7)

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

__NEXT_EXPERIMENTAL_PPR=true pnpm test-dev test/e2e/opentelemetry/client-trace-metadata/client-trace-metadata.test.ts (PPR)

  • clientTraceMetadata > app router > should inject propagation data for a dynamically server-side-rendered page
  • clientTraceMetadata > app router > hard loading a dynamic page twice should yield different dynamic trace data
  • clientTraceMetadata > app router > should only insert the client trace metadata once
  • clientTraceMetadata > app router > next dev only > should inject propagation data for a statically server-side-rendered page
  • clientTraceMetadata > app router > next dev only > soft navigating to a dynamic page should not transform previous propagation data
  • clientTraceMetadata > app router > next dev only > soft navigating to a static page should not transform previous propagation data
  • clientTraceMetadata > pages router > should inject propagation data for a dynamically server-side-rendered page
  • clientTraceMetadata > pages router > hard loading a dynamic page twice should yield different dynamic trace data
  • clientTraceMetadata > pages router > next dev only > should inject propagation data for a statically server-side-rendered page
  • clientTraceMetadata > pages router > next dev only > soft navigating to a dynamic page should not transform previous propagation data
  • clientTraceMetadata > pages router > next dev only > soft navigating to a static page should not transform previous propagation data
Expand output

● clientTraceMetadata › app router › should inject propagation data for a dynamically server-side-rendered page

Failed to start server after 10000ms, waiting for this log pattern: / ✓ Ready in /

  347 |     return setTimeout(() => {
  348 |       reject(
> 349 |         new Error(
      |         ^
  350 |           `Failed to start server after ${ms}ms, waiting for this log pattern: ${this.serverReadyPattern}`
  351 |         )
  352 |       )

  at Timeout._onTimeout (lib/next-modes/base.ts:349:9)

● clientTraceMetadata › app router › hard loading a dynamic page twice should yield different dynamic trace data

Failed to start server after 10000ms, waiting for this log pattern: / ✓ Ready in /

  347 |     return setTimeout(() => {
  348 |       reject(
> 349 |         new Error(
      |         ^
  350 |           `Failed to start server after ${ms}ms, waiting for this log pattern: ${this.serverReadyPattern}`
  351 |         )
  352 |       )

  at Timeout._onTimeout (lib/next-modes/base.ts:349:9)

● clientTraceMetadata › app router › should only insert the client trace metadata once

Failed to start server after 10000ms, waiting for this log pattern: / ✓ Ready in /

  347 |     return setTimeout(() => {
  348 |       reject(
> 349 |         new Error(
      |         ^
  350 |           `Failed to start server after ${ms}ms, waiting for this log pattern: ${this.serverReadyPattern}`
  351 |         )
  352 |       )

  at Timeout._onTimeout (lib/next-modes/base.ts:349:9)

● clientTraceMetadata › app router › next dev only › should inject propagation data for a statically server-side-rendered page

Failed to start server after 10000ms, waiting for this log pattern: / ✓ Ready in /

  347 |     return setTimeout(() => {
  348 |       reject(
> 349 |         new Error(
      |         ^
  350 |           `Failed to start server after ${ms}ms, waiting for this log pattern: ${this.serverReadyPattern}`
  351 |         )
  352 |       )

  at Timeout._onTimeout (lib/next-modes/base.ts:349:9)

● clientTraceMetadata › app router › next dev only › soft navigating to a dynamic page should not transform previous propagation data

Failed to start server after 10000ms, waiting for this log pattern: / ✓ Ready in /

  347 |     return setTimeout(() => {
  348 |       reject(
> 349 |         new Error(
      |         ^
  350 |           `Failed to start server after ${ms}ms, waiting for this log pattern: ${this.serverReadyPattern}`
  351 |         )
  352 |       )

  at Timeout._onTimeout (lib/next-modes/base.ts:349:9)

● clientTraceMetadata › app router › next dev only › soft navigating to a static page should not transform previous propagation data

Failed to start server after 10000ms, waiting for this log pattern: / ✓ Ready in /

  347 |     return setTimeout(() => {
  348 |       reject(
> 349 |         new Error(
      |         ^
  350 |           `Failed to start server after ${ms}ms, waiting for this log pattern: ${this.serverReadyPattern}`
  351 |         )
  352 |       )

  at Timeout._onTimeout (lib/next-modes/base.ts:349:9)

● clientTraceMetadata › pages router › should inject propagation data for a dynamically server-side-rendered page

Failed to start server after 10000ms, waiting for this log pattern: / ✓ Ready in /

  347 |     return setTimeout(() => {
  348 |       reject(
> 349 |         new Error(
      |         ^
  350 |           `Failed to start server after ${ms}ms, waiting for this log pattern: ${this.serverReadyPattern}`
  351 |         )
  352 |       )

  at Timeout._onTimeout (lib/next-modes/base.ts:349:9)

● clientTraceMetadata › pages router › hard loading a dynamic page twice should yield different dynamic trace data

Failed to start server after 10000ms, waiting for this log pattern: / ✓ Ready in /

  347 |     return setTimeout(() => {
  348 |       reject(
> 349 |         new Error(
      |         ^
  350 |           `Failed to start server after ${ms}ms, waiting for this log pattern: ${this.serverReadyPattern}`
  351 |         )
  352 |       )

  at Timeout._onTimeout (lib/next-modes/base.ts:349:9)

● clientTraceMetadata › pages router › next dev only › should inject propagation data for a statically server-side-rendered page

Failed to start server after 10000ms, waiting for this log pattern: / ✓ Ready in /

  347 |     return setTimeout(() => {
  348 |       reject(
> 349 |         new Error(
      |         ^
  350 |           `Failed to start server after ${ms}ms, waiting for this log pattern: ${this.serverReadyPattern}`
  351 |         )
  352 |       )

  at Timeout._onTimeout (lib/next-modes/base.ts:349:9)

● clientTraceMetadata › pages router › next dev only › soft navigating to a dynamic page should not transform previous propagation data

Failed to start server after 10000ms, waiting for this log pattern: / ✓ Ready in /

  347 |     return setTimeout(() => {
  348 |       reject(
> 349 |         new Error(
      |         ^
  350 |           `Failed to start server after ${ms}ms, waiting for this log pattern: ${this.serverReadyPattern}`
  351 |         )
  352 |       )

  at Timeout._onTimeout (lib/next-modes/base.ts:349:9)

● clientTraceMetadata › pages router › next dev only › soft navigating to a static page should not transform previous propagation data

Failed to start server after 10000ms, waiting for this log pattern: / ✓ Ready in /

  347 |     return setTimeout(() => {
  348 |       reject(
> 349 |         new Error(
      |         ^
  350 |           `Failed to start server after ${ms}ms, waiting for this log pattern: ${this.serverReadyPattern}`
  351 |         )
  352 |       )

  at Timeout._onTimeout (lib/next-modes/base.ts:349:9)

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

pnpm test-start-turbo test/e2e/app-dir/use-cache-unknown-cache-kind/use-cache-unknown-cache-kind.test.ts (turbopack)

  • use-cache-unknown-cache-kind > should fail the build with an error
Expand output

● use-cache-unknown-cache-kind › should fail the build with an error

expect(received).toMatchInlineSnapshot(snapshot)

Snapshot name: `use-cache-unknown-cache-kind should fail the build with an error 1`

- Snapshot  - 1
+ Received  + 2

@@ -10,6 +10,7 @@

  Unknown cache kind "custom". Please configure a cache handler for this kind in the "experimental.cacheHandlers" object in your Next.js config.



-     at <unknown> (./app/page.tsx:1:1)"
+     at <unknown> (./app/page.tsx:1:1)
+ "

  36 |
  37 |       if (isTurbopack) {
> 38 |         expect(buildOutput).toMatchInlineSnapshot(`
     |                             ^
  39 |           "Error: Turbopack build failed with 1 errors:
  40 |           Page: {"type":"app","side":"server","page":"/page"}
  41 |           ./app/page.tsx:1:1

  at Object.toMatchInlineSnapshot (e2e/app-dir/use-cache-unknown-cache-kind/use-cache-unknown-cache-kind.test.ts:38:29)

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

pnpm test-dev test/development/middleware-errors/index.test.ts

  • middleware - development errors > when middleware throws synchronously > renders the error correctly and recovers
  • middleware - development errors > when running invalid dynamic code with eval > renders the error correctly and recovers
  • middleware - development errors > when throwing while loading the module > renders the error correctly and recovers
Expand output

● middleware - development errors › when middleware throws synchronously › renders the error correctly and recovers

Expected no Redbox but found one
header: 1 of 1 error
Next.js (15.0.4-canary.48)
Server Error

Error: boom

This error happened while generating the page. Any console logs will be displayed in the terminal window.
description: Error: boom
source: middleware.js (3:15) @ default

  1 |
  2 |       export default function () {
> 3 |         throw new Error('boom')
    |               ^
  4 |       }

  59 |       await assertHasRedbox(browser)
  60 |       await next.patchFile('middleware.js', `export default function () {}`)
> 61 |       await assertNoRedbox(browser)
     |       ^
  62 |     })
  63 |   })
  64 |

  at Object.<anonymous> (development/middleware-errors/index.test.ts:61:7)

● middleware - development errors › when running invalid dynamic code with eval › renders the error correctly and recovers

Expected no Redbox but found one
header: 1 of 1 error
Next.js (15.0.4-canary.48)
Server Error

ReferenceError: test is not defined

This error happened while generating the page. Any console logs will be displayed in the terminal window.
description: ReferenceError: test is not defined
source: middleware.js (4:9) @ eval

  2 |       import { NextResponse } from 'next/server'
  3 |       export default function () {
> 4 |         eval('test')
    |         ^
  5 |         return NextResponse.next()
  6 |       }

  185 |       }, 10000) // middleware rebuild takes a while in CI
  186 |
> 187 |       await assertNoRedbox(browser)
      |       ^
  188 |     })
  189 |   })
  190 |

  at Object.<anonymous> (development/middleware-errors/index.test.ts:187:7)

● middleware - development errors › when throwing while loading the module › renders the error correctly and recovers

Expected no Redbox but found one
header: 1 of 1 error
Next.js (15.0.4-canary.48)
Server Error

Error: booooom!

This error happened while generating the page. Any console logs will be displayed in the terminal window.
description: Error: booooom!
source: middleware.js (3:13) @ eval

  1 |
  2 |       import { NextResponse } from 'next/server'
> 3 |       throw new Error('booooom!')
    |             ^
  4 |       export default function () {
  5 |         return NextResponse.next()
  6 |       }

  232 |       expect(source).not.toContain('//middleware.js')
  233 |       await next.patchFile('middleware.js', `export default function () {}`)
> 234 |       await assertNoRedbox(browser)
      |       ^
  235 |     })
  236 |   })
  237 |

  at Object.<anonymous> (development/middleware-errors/index.test.ts:234:7)

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

@ijjk
Copy link
Member

ijjk commented Dec 9, 2024

Stats from current PR

Default Build (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary vercel/next.js sebbie/12-08-ignore-list_externals Change
buildDuration 36.8s 33.3s N/A
buildDurationCached 33.4s 28.8s N/A
nodeModulesSize 409 MB 409 MB ⚠️ +15.5 kB
nextStartRea..uration (ms) 845ms 853ms N/A
Client Bundles (main, webpack)
vercel/next.js canary vercel/next.js sebbie/12-08-ignore-list_externals Change
1187-HASH.js gzip 50.2 kB 50.2 kB N/A
8276.HASH.js gzip 169 B 168 B N/A
8377-HASH.js gzip 5.3 kB 5.3 kB N/A
bccd1874-HASH.js gzip 53 kB 53 kB N/A
framework-HASH.js gzip 57.5 kB 57.5 kB N/A
main-app-HASH.js gzip 232 B 235 B N/A
main-HASH.js gzip 33.8 kB 33.7 kB N/A
webpack-HASH.js gzip 1.71 kB 1.71 kB N/A
Overall change 0 B 0 B
Legacy Client Bundles (polyfills)
vercel/next.js canary vercel/next.js sebbie/12-08-ignore-list_externals 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/12-08-ignore-list_externals Change
_app-HASH.js gzip 193 B 193 B
_error-HASH.js gzip 193 B 193 B
amp-HASH.js gzip 512 B 510 B N/A
css-HASH.js gzip 343 B 342 B N/A
dynamic-HASH.js gzip 1.84 kB 1.84 kB
edge-ssr-HASH.js gzip 265 B 265 B
head-HASH.js gzip 363 B 362 B N/A
hooks-HASH.js gzip 393 B 392 B N/A
image-HASH.js gzip 4.44 kB 4.43 kB N/A
index-HASH.js gzip 268 B 268 B
link-HASH.js gzip 2.35 kB 2.34 kB N/A
routerDirect..HASH.js gzip 328 B 328 B
script-HASH.js gzip 397 B 397 B
withRouter-HASH.js gzip 323 B 326 B N/A
1afbb74e6ecf..834.css gzip 106 B 106 B
Overall change 3.59 kB 3.59 kB
Client Build Manifests
vercel/next.js canary vercel/next.js sebbie/12-08-ignore-list_externals Change
_buildManifest.js gzip 747 B 745 B N/A
Overall change 0 B 0 B
Rendered Page Sizes
vercel/next.js canary vercel/next.js sebbie/12-08-ignore-list_externals Change
index.html gzip 524 B 524 B
link.html gzip 539 B 539 B
withRouter.html gzip 520 B 521 B N/A
Overall change 1.06 kB 1.06 kB
Edge SSR bundle Size
vercel/next.js canary vercel/next.js sebbie/12-08-ignore-list_externals Change
edge-ssr.js gzip 128 kB 128 kB N/A
page.js gzip 203 kB 203 kB N/A
Overall change 0 B 0 B
Middleware size
vercel/next.js canary vercel/next.js sebbie/12-08-ignore-list_externals Change
middleware-b..fest.js gzip 670 B 669 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
vercel/next.js canary vercel/next.js sebbie/12-08-ignore-list_externals Change
523-experime...dev.js gzip 322 B 322 B
523.runtime.dev.js gzip 314 B 314 B
app-page-exp...dev.js gzip 322 kB 322 kB
app-page-exp..prod.js gzip 127 kB 127 kB
app-page-tur..prod.js gzip 140 kB 140 kB
app-page-tur..prod.js gzip 135 kB 135 kB
app-page.run...dev.js gzip 312 kB 312 kB
app-page.run..prod.js gzip 122 kB 122 kB
app-route-ex...dev.js gzip 37.1 kB 37.1 kB
app-route-ex..prod.js gzip 25.1 kB 25.1 kB
app-route-tu..prod.js gzip 25.1 kB 25.1 kB
app-route-tu..prod.js gzip 24.9 kB 24.9 kB
app-route.ru...dev.js gzip 38.7 kB 38.7 kB
app-route.ru..prod.js gzip 24.9 kB 24.9 kB
pages-api-tu..prod.js gzip 9.56 kB 9.56 kB
pages-api.ru...dev.js gzip 11.4 kB 11.4 kB
pages-api.ru..prod.js gzip 9.56 kB 9.56 kB
pages-turbo...prod.js gzip 21.3 kB 21.3 kB
pages.runtim...dev.js gzip 27 kB 27 kB
pages.runtim..prod.js gzip 21.3 kB 21.3 kB
server.runti..prod.js gzip 916 kB 916 kB N/A
Overall change 1.43 MB 1.43 MB
build cache Overall increase ⚠️
vercel/next.js canary vercel/next.js sebbie/12-08-ignore-list_externals Change
0.pack gzip 2.04 MB 2.04 MB ⚠️ +2.41 kB
index.pack gzip 146 kB 147 kB ⚠️ +791 B
Overall change 2.18 MB 2.18 MB ⚠️ +3.2 kB
Diff details
Diff for main-HASH.js

Diff too large to display

Diff for server.runtime.prod.js

Diff too large to display

Commit: 39ca37e

@eps1lon eps1lon force-pushed the sebbie/12-08-ignore-list_externals branch 2 times, most recently from 38fc56b to 122f209 Compare December 9, 2024 15:02
@eps1lon eps1lon force-pushed the sebbie/12-08-ignore-list_externals branch from 122f209 to 39ca37e Compare December 9, 2024 16:03
@eps1lon eps1lon marked this pull request as ready for review December 9, 2024 16:07
@eps1lon eps1lon requested a review from huozhi December 9, 2024 16:24
@eps1lon
Copy link
Member Author

eps1lon commented Dec 9, 2024

CI failures are unrelated.

@eps1lon eps1lon merged commit 4c7ef6a into canary Dec 9, 2024
104 of 113 checks passed
@eps1lon eps1lon deleted the sebbie/12-08-ignore-list_externals branch December 9, 2024 17:18
@eps1lon eps1lon mentioned this pull request Dec 9, 2024
@eps1lon
Copy link
Member Author

eps1lon commented Dec 9, 2024

CI failures are unrelated.

Narrator: They were related.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 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.

2 participants