diff --git a/packages/next/src/client/app-index.tsx b/packages/next/src/client/app-index.tsx index f54d9ac06ca39..43cc320de537a 100644 --- a/packages/next/src/client/app-index.tsx +++ b/packages/next/src/client/app-index.tsx @@ -19,7 +19,8 @@ import { HMR_ACTIONS_SENT_TO_BROWSER } from '../server/dev/hot-reloader-types' // Since React doesn't call onerror for errors caught in error boundaries. const origConsoleError = window.console.error window.console.error = (...args) => { - if (isNextRouterError(args[0])) { + // error is the second argument to `console.error`: https://github.com/facebook/react/blob/d50323eb845c5fde0d720cae888bf35dedd05506/packages/react-reconciler/src/ReactFiberErrorLogger.js#L78 + if (isNextRouterError(args[1])) { return } origConsoleError.apply(window.console, args)