Open rick-liruixin opened 8 months ago
I have the same issue but on getStaticProps. It happens when you keep a page open and do a rebuild, and right after the rebuild you go to the page again, and click any internal links then you'll see their responses are empty.
So I checked an older Nextjs version(13.4.8) to see how it was working before.
Before, when you click any internal links after a rebuild, the JSON files will return 404 then sends you to the actual page.
Now using the latest version(14.1.0), when you click any internal links after a rebuild, the JSON files will return 200 but wont send you to the actual page.
It's probably a caching issue, the page doesn't seem to realize that the JSON URL doesn't exist anymore.
I believe it's a cache issue.
Next base server returns res.body("{}").send();
when there no content change.
Just to confirm, after you get that empty object, open the json link in a new tab and force page reload, do you see the content again ? If so, you need to force a res.setHeader('Cache-Control', 'no-store');
Another question, are you using any service workers ? pwa stuff ?
It's an issue if you are using the middleware with the pages directory. More can be found here: https://github.com/vercel/next.js/issues/57207, https://github.com/vercel/next.js/issues/59612. It was fixed in v14.1.1-canary.37, but was not included in the v14.1.1
release 🤷♂️
The latest stable release that does not have this issue is v13.4.12
I just discovered the same issue. The fix has been released in 14.2.0.
fix: status code for 404 props queries to avoid client side navigation with empty props: https://github.com/vercel/next.js/pull/60968
Link to the code that reproduces this issue
https://github.com/rick-liruixin/body-scroll-lock-upgrade/tree/next/examples/next
To Reproduce
After using getServerSideProps, when the server is redeployed, json and their responses are empty {}.
The code repository address is only a rough code, because it requires redeployment and other operations, and cannot provide a demonstration address
Reproduce the scene: 1, to be replicated in the deployed environment. 2, there are two server rendered a and b pages.
Current vs. Expected behavior
There should be data returned instead of empty objects
Provide environment information
Which area(s) are affected? (Select all that apply)
Data fetching (gS(S)P, getInitialProps)
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
No response