-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Middleware page data fetch 404 causing Page component to return undefined data #41113
Comments
Can you send the screenshot, please? |
I have added a video of the reproduction above https://www.loom.com/share/38e903f0c81147dda61a3230bdec886a |
@andrewnick The behavior reported at https://codesandbox.io/s/angry-nightingale-dgz4vo is expected behavior. Data from |
This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you. |
This issue has been automatically closed due to two years of inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding! |
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. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Vercel
Describe the Bug
In 4-5% of our users we are seeing in our google analytics that they are receiving a 'Page Not Found' for valid pages. These pages do work most of the time and so we have quite a bit of trouble replicating this issue.
Our page is a dynamic SSG page that when there is an issue with the data or an error comes back from our Apollo client it renders an Error component. The Error component will set the page to 'Page Not Found'. This issue has come in when upgrading to Next.js 12.2 and we believe it is to do with the update to the middleware. Unfortunately we need it for prefixing the default locale otherwise we could just remove it.
What we think could be the issue is that as there an extra fetch for page data when using middleware then it could be possible that the page is trying to fetch the data from an old deployment folder and then getting a 404 on the fetch. Once it 404's then undefined data is return to the component causing the Page component to render the Error component within it. In our datadog logs we do see 404 errors for the page data e.g /_next/data/TZOMVjjp6O7ETtw-t1234/en/page-name.json?slug=page-name.
Using a network interceptor tool (https://tamper.dev/) we can force a 404 and we do see the behaviour described above but without understanding how all this works under the hood it is hard to know if this is a valid test.
Expected Behavior
404's on the fetch for page data don't cause the page to break.
Link to reproduction
https://codesandbox.io/s/angry-nightingale-dgz4vo?file=/pages/%5B...slug%5D.tsx
To Reproduce
The text was updated successfully, but these errors were encountered: