-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
Error page displays invalid information #6243
Comments
I've been looking into this during the evening and have found out a couple of things:
I think we might need to add a way to specify a status-code to I also found a broken test relating to this in @timneutkens If adding |
I only noticed this for the first time in 8.0.0, didn't check if it existed earlier. Sounds like this may have been around for a little while then. |
Still a bug that needs fixing, glad you found it! :) When I thought some more about this I realised that maybe it would be nice allowing for configuring passing any of the values into ´getInitialProps´ for static exports? |
@Ephem I think it's not super useful to allow statusCode and it might be confusing to users that may expect that the file will hold that statusCode while in reality it will be what the web server they host on returns (most likely 200). When 404 is rendered
|
Yeah, that did give me some pause, and after sleeping on it I realised the use case for different status codes there (building error pages for other codes), can be solved without additional complexity by just adding custom pages for those anyway. Good call! I’ll work on a PR and also make sure that test is working correctly. :) |
Thank you @Ephem 🙏🙏🙏 |
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
I just upgraded to Next.js 8. When I visit a page that does not exist, the error message is "An unexpected error has occurred." which isn't entirely correct for a 404.
When looking at the source for the default error page it looks as though there is a check against the status code to see if a different message should be shown, but having a quick look at the developer tools it doesn't look like the status code is being passed through the props as expected.
In addition this line sets the title of the page but it looks wonky when the status code is not available, as shown in the attached screenshot.
To Reproduce
Run
next build && next export
and check the contents of the build404.html
file.I found this issue was present when deployed to Netlify also.
Expected behavior
The 404 error page indicates the page was not found, not that an error occurred.
Screenshots
This screenshot shows the broken
<title>
tag.System information
The text was updated successfully, but these errors were encountered: