Skip to content

Commit 7d2701a

Browse files
authored
[build-sourcemaps] Ensure errors during prerender can be sourcemapped (#78709)
These weren't sourcemapped because we logged the stack directly as a string. Only actual error instances will be sourcemapped not arbitrary strings. Now we'll also include digest and `cause` in the error.
1 parent 32acf1a commit 7d2701a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

packages/next/src/export/worker.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'
1919
import { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'
2020
import { trace } from '../trace'
2121
import { setHttpClientAndAgentOptions } from '../server/setup-http-agent-env'
22-
import isError from '../lib/is-error'
2322
import { addRequestMeta } from '../server/request-meta'
2423
import { normalizeAppPath } from '../shared/lib/router/utils/app-paths'
2524

@@ -571,12 +570,11 @@ async function exportPage(
571570
// A static generation bailout error is a framework signal to fail static generation but
572571
// and will encode a reason in the error message. If there is a message, we'll print it.
573572
// Otherwise there's nothing to show as we don't want to leak an error internal error stack to the user.
573+
// TODO: Always log the full error. ignore-listing will take care of hiding internal stacks.
574574
if (isStaticGenBailoutError(err)) {
575575
if (err.message) {
576576
console.error(`Error: ${err.message}`)
577577
}
578-
} else if (isError(err) && err.stack) {
579-
console.error(err.stack)
580578
} else {
581579
console.error(err)
582580
}

0 commit comments

Comments
 (0)