Server-side rendering not working on production in next@12.1.6
See original GitHub issueVerify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System: Platform: Windows Arch: x64 Version: 20H2 Binaries: Node: v14.17.6 npm: 8.1.3 Yarn: 1.22.17 Relevant packages: next: 12.1.6 react: 17.0.2 react-dom: 17.0.2
What browser are you using? (if relevant)
Chrome 102.0.5005.115
How are you deploying your application? (if relevant)
next build
Describe the Bug
When using server-side rendering with next@12.1.6, the context doesn’t get passed down to the children component. When trying to log the context value, the context gets logged on the client-side but not on the server-side.
NOTE: This issue cannot be reproduced with other versions of nextjs and is only specific to 12.1.6.
The issue also gets resolved when upgrading react to the latest version i.e. 18.2.0.
This works with next dev
but fails with next build
&& next start
.
Expected Behavior
The context should get passed down to the children on the server-side in production.
Link to reproduction
https://github.com/sc-addypathania/nextjs-bug-repro/tree/main
To Reproduce
- npm run build
- npm run start
- Check the console/terminal the context is coming out to be undefined whereas its getting logged correctly on the browser
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7
Top GitHub Comments
Encountered the same bug, just with
next@12.2.1
. Usingreact-intl
and it’sinjectIntl
helper results in the problematic behavior. This might be the same bug as described here https://github.com/vercel/next.js/issues/38332Can confirm latest react addresses this, but I’m not ready yet to upgrade. Quite a nasty surprise and took a while to figure out what was happening 😞 if the fix isn’t trivial it would be nice to have it mentioned in the migration guide so others can save time
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.