-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
[BUG] ZenStackHooksProvider
causes internal server error in Next.js v14.2.10 or newer
#1714
Comments
ZenStackHooksProvider
causes internal server error in Next.js v14.2.10 or newer
Thank you for the detailed bug report and a repro @andrictham ! I'll look into it. |
Hi @andrictham , thanks for the wait. It turns out the problem is related to the config in next.config.mjs: serverComponentsExternalPackages: ["@zenstackhq/runtime"], The config was needed in older ZenStack releases (when runtime wasn't compatible with Next 13+ RSC handling). It's not needed with new versions anymore. Removing it seems to fix the issue, although I don't know why ... it probably breaks one of the many black magics inside nextjs ... |
@ymc9 Thanks for helping me track down the source of the issue! I’ve verified that removing that line does indeed fix the issue and I’m now able to upgrade Next now with no problem. Will close the issue now. |
Description and expected behavior
In Next.js 14.2.10, as well as the latest 14.2.12, wrapping the app in
ZenStackHooksProvider
as exported from"../lib/hooks"
causes Next.js to throw an Internal Server Error on every page.In development, I see a 500 error in the browser console for every page, even though the page itself renders properly.
This could be due to static generation or SSR of the page failing, but not client-side rendering:
This is what’s shown on the server console in development
In addition, the app will refuse to build during compilation of static pages, with the following build error:
Next.js 14.2.10 is an urgent security patch, so this is critical to fix. See vulnerability here: GHSA-gp8f-8m3g-qvj9
Everything works in Next.js 14.2.8. This is the last known working version. I have not tried 14.2.9, but it’s possible a change in that version broke something.
Screenshots
Environment (please complete the following information):
Additional context
You can find a reproduction of this bug in this repo, which uses Clerk and ZenStack:
https://github.com/andrictham/zenstack-next-500-error
There are 3 branches:
main
: Shows this error on Next.js 14.2.10WORKING_Next-14.2.10_No-ZenStackHooksProvider
: Shows the error goes away in Next.js 14.2.10 if the hooks provider is removed from the React treeWORKING_Next-14.2.8
: Shows this error goes away if we downgrade to Next.js 14.2.8To setup the repo locally, you’ll need add your Clerk creds to your
.env
.The text was updated successfully, but these errors were encountered: