-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
Hooks is null
on SSR after 13.4.13 and up
#54429
Comments
useEffect
being executed on SSR after 13.4.13
useEffect
being executed on SSR after 13.4.13null
on SSR after 13.4.13
I saw that https://unpkg.com/browse/next@13.4.19/dist/compiled/react/ How does |
null
on SSR after 13.4.13null
on SSR after 13.4.13 and up
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
|
I've been debugging this issue for 3 days. The team/client has decided to not invest more time into this. Maybe in the future. I think it might have something todo with the bundled version and Is Next.js battle tested with |
Next.js works well with pnpm (in fact, we are using it in this repo and for all tests, etc., we also have tests for veryfing compatibility), but it's hard to tell more about your use case without having a look at your code. I'm going to close this for now since say you cannot invest more time into making a reproduction. If that changes, feel free to open a new issue with one and we will look into it! |
I'm seeing the exact same error when running I've (also) tracked it down to being a problem since 13.4.13: https://github.com/vercel/next.js/releases/tag/v13.4.13 Works fine on 13.4.12 and lower. Once I upgrade to 13.4.13 I get the error like @EloB mentioned. Also tried different versions of react-query, but that does not seem to have any effect.
|
@jvandenaardweg do you also have apollo client? |
@EloB nope! |
@jvandenaardweg Good to know. I thought it maybe was that. It's weird that Have you tried to add in
|
This comment has been minimized.
This comment has been minimized.
Only one developer on our team is encountering this issue.. same setup with pnpm and Next 13.4.19 using /app. The app runs fine, his console is just unreadable.
|
Maybe reopen this? Multiple different consumers getting the same problem. |
None of the other comments are providing helpful information to track this down.
If this is not true anymore, the correct action here that provides the most help for us to investigate is to open a new issue with a minimal reproduction. |
This closed issue has been automatically locked because it had no new activity for 2 weeks. 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.6.0: Wed Jul 5 22:21:53 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6020 Binaries: Node: 16.15.1 npm: 8.11.0 Yarn: 1.22.19 pnpm: 8.2.0 Relevant Packages: next: 13.4.20-canary.2 eslint-config-next: 12.3.4 react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.6 Next.js Config: output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
TanStack/query#5371
To Reproduce
I don't have any reproduce repo but I found this issue describing a simliar situation as our error. The error was introduced for us in
13.4.13
and still exists in13.4.20-canary.2
. In13.4.12
everything works fine for us.App.getInitialProps
. We use this pattern <AppTree /> is incorrect #9336 (comment). A thought might be theawait getDataFromTree(<AppTree {...treeProps} />);
being executed inApp.getInitialProps
. This might be the cause forrenderWithHooks
?app/
.pages/
.@tanstack/react-query
. It fails because it tries to runuseEffect
in SSR and thereforuseEffect
becomesnull
and throws an error. I saw that they had'use client'
in that failing file. Maybe has something todo with it. I'm unsure if@tanstack/react-query
is the source error or the first occurrence ofuseEffect
. Adding the experimentalappDir: false
in thenext.config.js
fixed the issue a bit but then instead get this error:Sometimes the server starts up without errors but making multiple requests before all startup script than we see that above error more frequently. So it seems like a queuing issue.
When using canary without
appDir: false
I get this error:Running these shows the project only containing one version of
react
andreact-dom
except those bundled innext
so it doesn't seem to be multiple react versions and our ESLint isn't complaining about "Rules of Hooks".Describe the Bug
It runs
useEffect
on SSR.Expected Behavior
Don't expect
useEffect
to run on SSR.https://react.dev/reference/react/useEffect#caveats

Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: