-
Notifications
You must be signed in to change notification settings - Fork 27k
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
[NEXT-1152] TypeError: Cannot read properties of null (reading 'useContext') [Next js 13.4.1 throwing this error while using framer motion] #49355
Comments
I have this same issue but it seems to originate from nanostores for me. It only happens for me when building for Vercel - standard build is fine. It only occurs for me on pages in the pages directory and only when I also have pages in the app directory - occurring in my branch where I’m doing migration to /app not sure if these differences should require opening a separate issue? |
This is also happening without Next. I am using plain React 18.2 built with Parcel. |
@Alshie yuh the standard build was working fine for me too. But after vercel build failed my standard build also started failing with the same error logs. |
@AnotherDolphin were you able to find any solution for it? I solved my issue by downgrading next version though. |
I filed a possibly related or same root cause issue: #49376 |
I just ran across this issue while running
17 tests fail, most due to:
|
Also encountered this issue after updating from 13.1.6 to 13.4.1 while running |
I can repro this in the pages directory with a custom server (in my case, using Minimal repro: sophiebits/next-issue-49355@main. Run
When options.customServer is cc @shuding |
@sophiebits I just tore my app apart piece by piece and was surprised to discover that our use of a custom server was the culprit! I can confirm your report and is the cause of my other issue #49376 13.3.4 is ✅ |
Any solution for this issue? I'm facing it too. |
Same issue here, but not using framer-motion. I only get this error on 13.4.0 while building on Vercel, but not developing locally. 13.3.4 is fine. |
FWIW we only use a custom server to support local development over HTTPS. Surprisingly, this seems to be a long running and quite controversial issue: #10935 |
Now I'm getting this issue:
Any solution for it? |
try locking your package version for nextjs as a temp fix. |
Same issue here for any React hooks fired inside an ESM transpiled module. 13.4.1 will throw "Cannot read properties of null" for useMemo, useCallback, etc. Pages (which works perfectly fine with 13.3) not App dir. |
I'm wondering if this is fixed in 13.4.1-canary.2+ (by #49274). Can anyone create a reproduction? I tried Framer Motion with a simple |
My repro above (#49355 (comment)) still seems to give the error for me on 13.4.3-canary.0 (you may need to Since it doesn't use |
Same issue for me with next-mdx-remote. Works fine with 13.3.4 but not anymore with 13.4.x |
@sophiebits I think there're 2 issues, I'm trying to address the custom server one with #49805. But also see reports about normal |
I can confirm that 13.4.3 works as expected with a custom server for an app not yet using the |
For custom server, the fix (#49805) was landed in 13.4.3. |
@shuding Here is a minimal repo that reproduces the crash: https://github.com/conico974/next-app-dir |
#50158 is this issue related? Literally getting the same issue with the pages directory. Any update on this? |
@shuding Something of note: i am running in monorepo where my app is at the path |
Can someone create a minimal reproduction that still failing with the latest canary as previous issues seem to be resolved? 🙏 |
I have a screen recording for now, I can try to get a repo up later. This is using next nextjs-13-4-4-canary-3-missing-hooks.mov |
Hi @huozhi I can no longer reproduce this on the latest canary but instead I'm seeing some other behavior that is explained and reproduced on a branch here: https://github.com/CobyPear/repro-no-router/tree/use-latest-canaries |
I still have this error on |
Same issue on Update:Resolved, for me it was an env line |
I'm getting the same error for our component library, but only when using We use the It works fine when the package is actually published, so a workaround for now it to temporarily downgrade Next when using npm link. This will be a problem once we start migrating to the new app directory, though.. |
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
|
@huozhi TLDR; Had a lot of other issues as well with other things (deployments, edge runtime, a lot of deleting, modifying, testing etc), so I don't really recall why I've added it in the first place (might have followed this #48964). Now it works and with a quick new create-next-app repo I can't reproduce it (before I've dissected my cloned app to bare bones and I could). If I encounter this again - I'll create a repo for reproduction. But thank you for reaching out a hand! ❤️ |
I was having an issue with this where I'd get an error about I updated to 13.4.3 and it now builds on both my local machine and vercel fine. |
Wanted to cross-link this issue with #48518 (comment) which felt very similar. |
Few related fixes are released in 13.4.4, please try to upgrade to latest and test to see if the issue still existed. Will close this issue as there's no new reproduction testing against latest canary. If you still bumped to troubles, please file a new issue with minimal reproduction with latest canary. |
Confirming still seeing issues on
This for every page in my app when it gets to the compiling page data step:
Works perfectly fine with |
@jakeleventhal can you open an new issue with reproduction? It's helpful for tracing and narrowing down the issue, it's hard to tell from the error trace without knowing what configs you have set up |
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
"name": "next-paint", |
@huozhi Does the |
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 20.6.0: Wed Jan 12 22:22:42 PST 2022; root:xnu-7195.141.19~2/RELEASE_X86_64 Binaries: Node: 20.1.0 npm: 9.6.6 Yarn: 1.22.18 pnpm: N/A Relevant packages: next: 13.4.1 eslint-config-next: 13.4.0 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
none
To Reproduce
Use "Framer motion" in next JS 13.14.1 version
Describe the Bug
Getting this error log every time after trying to deploy the code in vercel. Downgrading Next JS version to 13.3.1 solved the issue.
Expected Behavior
Should have worked regardless of the version of Next JS.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
NEXT-1152
The text was updated successfully, but these errors were encountered: