Verify canary release
Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
Binaries:
Node: 16.17.1
npm: 8.15.0
Yarn: N/A
pnpm: 7.13.6
Relevant packages:
next: 13.0.1
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
What browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
No response
Describe the Bug
Using /app/notes/[id]/error.tsx with Webpack (Turbopack doesn't support tailwind) would break and throw the following error. This seems to happen only with dynamic routes like /notes/[id]/error.tsx and not with /notes/error.tsx
Error: Functions cannot be passed directly to Client Components because they're not serializable.
<... parallelRouterKey=... segmentPath=... loading=... hasLoading=... error={function} template=... notFound=... childProp=... rootLayoutIncluded=...>
^^^^^^^^^^
at resolveModelToJSON (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1710:39)
at Object.toJSON (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1081:40)
at stringify (<anonymous>)
at processModelChunk (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:163:36)
at retryTask (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1823:50)
at performWork (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1856:33)
at AsyncLocalStorage.run (node:async_hooks:330:14)
at eval (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1934:55)
at scheduleWork (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:52:25)
at startWork (webpack-internal:///(sc_server)/./node_modules/next/dist/compiled/react-server-dom-webpack/server.browser.js:1933:29)
Expected Behavior
error.tsx components should not throw errors.
Link to reproduction
https://stackblitz.com/edit/vercel-next-js-1aokay?file=app%2Fnotes%2F[id]%2Ferror.tsx
To Reproduce
Click the link in the browser to navigate to /notes/1
Verify canary release
Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
Binaries:
Node: 16.17.1
npm: 8.15.0
Yarn: N/A
pnpm: 7.13.6
Relevant packages:
next: 13.0.1
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
What browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
No response
Describe the Bug
Using
/app/notes/[id]/error.tsxwith Webpack (Turbopack doesn't support tailwind) would break and throw the following error. This seems to happen only with dynamic routes like/notes/[id]/error.tsxand not with/notes/error.tsxExpected Behavior
error.tsxcomponents should not throw errors.Link to reproduction
https://stackblitz.com/edit/vercel-next-js-1aokay?file=app%2Fnotes%2F[id]%2Ferror.tsx
To Reproduce
Click the link in the browser to navigate to /notes/1