-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Unable to obtain statusCode on a client-side rendered error page in next 7.0.2 #5437
Comments
Given that this issue is likely to be related with a security fix in 7.0.2, I'd like to add that a UPD: CVE is finally there: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-18282 |
The CVE is on the way. It's a manual process on their side and we'll update the link soon. |
Is this being fixed in Next.js 8 as a result of the refactoring? Just curious 😉 |
@kachkaev I'm not going to block v8 on this, but definitely having someone look into it ASAP 🙏 Thanks for the ping! |
This is an appropriate default behavior because: 1. When the server encounters an error, the `err` property is set. 2. When the client-side application crashes, the `err` property is set. This means the "only" way to render the `/_error` page without an error is when a page is not found (special condition). Fixes vercel#6243 Closes vercel#5437
* Set default `Error` status code to 404 This is an appropriate default behavior because: 1. When the server encounters an error, the `err` property is set. 2. When the client-side application crashes, the `err` property is set. This means the "only" way to render the `/_error` page without an error is when a page is not found (special condition). Fixes #6243 Closes #5437 * Add new integration test for client side 404 * single quotes * Remove unused variable * Standard needs to go away * Whoops * Check for null status code in res and err * Only check response for valid statusCode
Bug report
Describe the bug
Upgrading next to 7.0.2 makes it impossible to render a 404 page on the client when a person loads a server-rendered 404 page, then navigates to some other page and finally goes back to a 404 page using browser navigation. This applies to production environment only (in dev, 404 throws anyway).
To Reproduce
MWE: https://github.com/kachkaev/next.js-5437
Go to
http://localhost:3000/asdf
(non-existing page). You will seeError: 404
(it is server-rendered).Click on main page, see URL changed to
http://localhost:3000/
.Press back in your browser to return to
http://localhost:3000/asdf
. You will seeError: 404
again, now rendered on the client. So far so good – it'snext@7.0.1
. Here's where custom status code is coming from inpages/_error.js
:(
res
is used during SSR anderr
is used during the client-side rendering)yarn add next@7.0.2 yarn build && yarn start
Repeat steps 2-4. In step 4, you will see
Error: unknown
instead ofError: 404
. This means that the page will look like if the web app crashed badly. The cause of this behaviour is thaterr
is now undefined ingetInitialProps
, unlike in 7.0.1.System information
The text was updated successfully, but these errors were encountered: