-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Enabling draft mode causes "Invariant: expected pageData to be a string, got undefined" #61377
Labels
bug
Issue was opened via the bug report template.
locked
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Comments
github-actions
bot
added
the
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
label
Jan 30, 2024
Ethan-Arrowood
added a commit
that referenced
this issue
Feb 21, 2024
### What? In today's implementation, requests that don't end in `.rsc` are getting the data request query. We need to remove this toggle to prevent them from 500'ing. ### Why? The invariant triggered was: https://github.com/vercel/next.js/blob/212553958c671ea1f71d96fbc97ea4b9e5019bf3/packages/next/src/server/base-server.ts#L2838-L2842 Crawling up the code, the conditional: https://github.com/vercel/next.js/blob/212553958c671ea1f71d96fbc97ea4b9e5019bf3/packages/next/src/server/base-server.ts#L2815 must be `true`. The variable `isDataReq` is set here: https://github.com/vercel/next.js/blob/212553958c671ea1f71d96fbc97ea4b9e5019bf3/packages/next/src/server/base-server.ts#L1833-L1839 This conditional expression is a bit complex, but it simplifies down to: - `isDataReq` is `true` when (TODO) - `isDataReq` is `false` when (TODO) ### How? Closes NEXT-2341 Fixes #61377 Tested manually by: - Building and packaging this branch locally - Deploying tarball and then depending on it as the Next.js version for an example app similar to the one reported by #61377 - Inspecting console for 500 errors. --------- Co-authored-by: JJ Kasper <jj@jjsweb.site> Co-authored-by: Zack Tanner <zacktanner@gmail.com>
Getting this error on Nextjs v14.1.0 with Sanity. It breaks my LiveVisualEditing functionality. |
Ethan-Arrowood
added a commit
that referenced
this issue
Feb 28, 2024
### What? In today's implementation, requests that don't end in `.rsc` are getting the data request query. We need to remove this toggle to prevent them from 500'ing. ### Why? The invariant triggered was: https://github.com/vercel/next.js/blob/212553958c671ea1f71d96fbc97ea4b9e5019bf3/packages/next/src/server/base-server.ts#L2838-L2842 Crawling up the code, the conditional: https://github.com/vercel/next.js/blob/212553958c671ea1f71d96fbc97ea4b9e5019bf3/packages/next/src/server/base-server.ts#L2815 must be `true`. The variable `isDataReq` is set here: https://github.com/vercel/next.js/blob/212553958c671ea1f71d96fbc97ea4b9e5019bf3/packages/next/src/server/base-server.ts#L1833-L1839 This conditional expression is a bit complex, but it simplifies down to: - `isDataReq` is `true` when (TODO) - `isDataReq` is `false` when (TODO) ### How? Closes NEXT-2341 Fixes #61377 Tested manually by: - Building and packaging this branch locally - Deploying tarball and then depending on it as the Next.js version for an example app similar to the one reported by #61377 - Inspecting console for 500 errors. --------- Co-authored-by: JJ Kasper <jj@jjsweb.site> Co-authored-by: Zack Tanner <zacktanner@gmail.com>
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
bug
Issue was opened via the bug report template.
locked
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Link to the code that reproduces this issue
https://github.com/benmerckx/next-debug
Live: https://next-debug-blush.vercel.app/
To Reproduce
Current vs. Expected behavior
When hosted on Vercel enabling draft mode and then requesting a previously static page dynamically via RSC payload (in this example by
router.refresh
) results in a 500 error response with the following error shown in the logs:Error: Invariant: expected pageData to be a string, got undefined
Stack trace
HTTP request (some headers stripped)
Minimal reproduction
This points to a possible issue with a cached version being expected:
next.js/packages/next/src/server/base-server.ts
Lines 2836 to 2840 in b8a7efc
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, Routing (next/router, next/navigation, next/link)
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
No response
The text was updated successfully, but these errors were encountered: