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

Increase stack trace limit on the server #43800

Merged
merged 11 commits into from Dec 12, 2022
Expand Up @@ -22,9 +22,12 @@ function isHydrationError(error: Error): boolean {
)
}

try {
Error.stackTraceLimit = 50
} catch {}
if (typeof window !== 'undefined') {
try {
// Increase the number of stack frames on the client
Error.stackTraceLimit = 50
} catch {}
}

const errorQueue: Array<Error> = []
const rejectionQueue: Array<Error> = []
Expand Down
4 changes: 4 additions & 0 deletions packages/next/server/dev/next-dev-server.ts
Expand Up @@ -148,6 +148,10 @@ export default class DevServer extends Server {
}

constructor(options: Options) {
try {
// Increase the number of stack frames on the server
Error.stackTraceLimit = 50
} catch {}
super({ ...options, dev: true })
this.renderOpts.dev = true
;(this.renderOpts as any).ErrorDebug = ReactDevOverlay
Expand Down