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
13.0.7 - minified react error #421 (does not happen in 13.0.6) #44083
Comments
Can confirm the same issue here. The full error is:
Happens even in blank components all random in the latest NextJS version. |
Same happens here in multiple apps when running in production. |
Also seeing this in 13.0.7.
|
We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate. Why was this issue marked with the
|
The link in the PR description is not accessible with password protected. Could someone provide a mini reproduction repo for this? |
Ive started to work on a reproduction here -> https://codesandbox.io/s/awesome-hermann-gu8kmj?file=/pages/index.tsx It appears to be caused (for my use case anyways) trying to dynamically load a styled-component with next/dynamice. |
There was an error |
You are correct. This is not the same error then. Do you want access to my company repo to look into the error reported? |
If someone else here is able to create a reproduction that would be great. |
Ok, I have managed to narrow down the culprit. Unfortunately I couldn't create a reproduction for this, but I can confirm the problem is specifically with The error occurs on components with dynamic when no option it set, or when the option contains |
I was able to localize the error in my project and reproduce it (with redux): https://codesandbox.io/p/sandbox/next-13-0-7-swkcsy. Up 1. When replacing redux with context, everything works without errors. |
@huozhi see above for a reproduction. This is happening in the current 13.1.0 version as well. |
This error is removed in facebook/react#25692, I tried |
so its because of react? I tried simple app, but the error is shown too (using package: |
The error mentioned in #44083 (comment) is removed in react. If it's still happening might be sth else |
@conquera99 your issue is from |
ahh my bad, thank you @huozhi |
I'm not sure if it is related. |
@huozhi As mentioned here facebook/react#25692, underlying issue is still there |
Nice find @oceandrama |
Echoing gusfune: Still encountering this issue on Next.js v13.1.1. Adding Example: import dynamic from 'next/dynamic';
const LazyComponent = dynamic(
() => import('./Component').then((mod) => mod.Component),
{ ssr: false },
); |
Updating to React 18.3 appears to fix the issue. |
How to get access to React 18.3? I checked on React repository but the latest available version is 18.2. |
react@next |
This only hides the error, but the issue is still there underlying. See first line of the PR for the change in React 18.3 -> facebook/react#25692 |
This is still the case as of
|
@klarstrup the error is removed, but the problem still exists. I'm personally not planning to upgrade to 13.1.1 or beyond even if 18.3 releases until we get word from the Next team they plan to fix the underlying issue. @balazsorban44 @huozhi |
This issue is related to dynamic import in nextjs. And next@latest |
Im guessing there will not be a fix for this. Still happening in 13.1.3. |
@wadehammes can you provide your mini reproduction? since the problems for above ones are resolved. need a repro for seeing how the prod error is triggered |
Can confirm this is still happening in 13.1.6. Caused by PR #42589. This is quite a breaking change, I'm surprised it was shipped in a minor release. People are avoiding upgrading their Next.js version or downgrading altogether to get around this issue, which is ironic because the PR was supposed to make upgrading/migration to the app folder easier. It may be appropriate to revisit the changes in this PR. |
I can't agree more. This is a big breaking change for all of my Next.js apps. Can't upgrade at all since 13.0.7. |
@wescopeland This is not (and is not designed to be) a breaking change. If there is a bug, we will patch it. Unfortunately, it has been hard to get a consistent reproduction of the issue (seems each case has been a little different based on the conversation above). We are trying out best here. Can you create a minimal reproduction please?
It is okay to watch to upgrade or downgrade minor or patch versions while a bug is being fixed. Based on the 16 thumbs up on this issue, it is definitely happening to some folks (and we want to continue looking into this with reproductions) but not a majority.
@phuctm97 this is not a breaking change – it seems there is a bug. Can you create a minimal reproduction please? |
I understand and this is appreciated; nice new website btw.
My perception is this is not happening on simple sites, but more complex webapps, which the majority of users are not building. This is also likely why it is harder to get a consistent repro and/or why each case has had subtle differences. @phuctm97 Do you have a repro you can share? I am only able to repro this in more-complex apps that are unfortunately locked down. |
Thanks for proceeding on this @leerob & @wescopeland. I have reproduced the issue here: https://github.com/phuctm97/repro-next-44083. The repository is created using Please search for "[BUG]" when you open the repo, you'll see the comments pointing you through the issue. Thank you! |
@phuctm97 I can see the issue in the reproduction, it's because the nested |
Thanks for updating @huozhi. Any suggested workaround or issue to track that issue. It is a big breaking blocker for me at the moment. |
@phuctm97 Since we introduced a layer of |
Thanks @huozhi! That works for simple fallback but if |
## Issue To address the problem that we introduced in 13.0.7 (#42589) where we thought we could use same implementation `next/dynamic` for both `pages/` and `app/` directory. But it turns out it leads to many problems, such as: * SSR preloading could miss the content, especially with nested dynamic calls * Closes #45213 * Introducing suspense boundary into `next/dynamic` with extra wrapped `<Suspense>` outside will lead to content is not resolevd during SSR * Related #45151 * Closes #45099 * Unexpected hydration errors for suspense boundaries. Though react removed this error but the 18.3 is not out yet. * Closes #44083 * Closes #45246 ## Solution Separate the dynamic implementation for `app/` dir and `pages/`. For `app/` dir we can encourage users to: * Directly use `React.lazy` + `Suspense` for SSR'd content, and `next/dynamic` * For non SSR components since it requires some internal integeration with next.js. For `pages/` dir we still keep the original implementation If you want to use `<Suspense>` with dynamic `fallback` value, use `React.lazy` + `Suspense` directly instead of picking up `next/dynamic` * Closes #45116 This will solve various issue before react 18.3 is out and let users still progressively upgrade to new versions of next.js. ## Bug Fix - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
Meanwhile, #45565 should resolve the problem since it reverts to the original implementation of dynamic for pages |
Got the fix out in v13.1.7-canary.5, can you try that version to see if it works for you? Thanks 🙏 |
I can confirm this appears to be fixed with v13.1.7-canary.5. ✨ |
I can confirm the issue appears to be fixed with v13.1.7-canary.5 too! Thank you! |
It works without |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000
Binaries:
Node: 16.18.1
npm: 8.19.2
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 13.0.6
eslint-config-next: 13.0.6
react: 18.2.0
react-dom: 18.2.0
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue
To Reproduce
Have a site running 13.0.7 with SSR, dynamic routes, and transpiled modules.
Describe the Bug
Recieve the below console error in both preview and local.
https://reactjs.org/docs/error-decoder.html/?invariant=421
Expected Behavior
No suspense boundary error as in 13.0.6
Which browser are you using? (if relevant)
Firefox
How are you deploying your application? (if relevant)
Vercel
The text was updated successfully, but these errors were encountered: