-
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
Issue using _error and 500 page #24206
Comments
This issue is appearing on the latest release build, 10.2.0, as well. |
I also have this issue. I'm trying to use a custom _error page, which works locally when you visit /throw (a page that throws an error), but neither Netlify or Vercel respect it when the app is deployed. Similar to @bduff9, I just receive a stack trace, which you can see here: https://60c22a5aaf61f200073ca417--nextjs-custom-error-test.netlify.app/throw I've been experimenting with a repo: https://github.com/jonathanwelton/nextjs-custom-error-test Reverting to Next.js 9.4.4, the custom _error page works on Vercel: https://nextjs-custom-error-test.vercel.app/throw But it doesn't appear you can deploy a Next.js app below version 10 on Netlify. |
Same thing here on Netlify, been following this guide as exactly as I can: https://github.com/vercel/next.js/tree/canary/examples/with-sentry |
This prevents unexpected errors occurring from users leveraging `getServerSideProps` in `_error` with the new `/500` prerendering as we are currently only checking for a custom `getInitialProps` in `_error` since it opts out of the static optimization although `getServerSideProps` also opts out of the optimization. Fixes: #23541 Fixes: #23128 Fixes: #23541 Fixes: #24206 ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added
…23586) This prevents unexpected errors occurring from users leveraging `getServerSideProps` in `_error` with the new `/500` prerendering as we are currently only checking for a custom `getInitialProps` in `_error` since it opts out of the static optimization although `getServerSideProps` also opts out of the optimization. Fixes: vercel#23541 Fixes: vercel#23128 Fixes: vercel#23541 Fixes: vercel#24206 ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added
…23586) This prevents unexpected errors occurring from users leveraging `getServerSideProps` in `_error` with the new `/500` prerendering as we are currently only checking for a custom `getInitialProps` in `_error` since it opts out of the static optimization although `getServerSideProps` also opts out of the optimization. Fixes: vercel#23541 Fixes: vercel#23128 Fixes: vercel#23541 Fixes: vercel#24206 ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
10.1.3
What version of Node.js are you using?
14.15.4
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
I am using Sentry so set up an _error.tsx file in the pages directory. I also need to setup custom 404 and 500 pages with specific branding (which requires a call to the fs module during build). The 404.tsx page works great, but I cannot get the 500.tsx to work during an actual error.
If I go to
/500
the page renders great. However, if I set up new page/test/error
that just throws an error server side, my 500 page partially renders, but most of the content gets replaced withAn unexpected error has occurred.
I tried multiple things to get around it, including moving the entire contents of the 500 to the _error.tsx. However, this fails to build since it seems that fs cannot be used there in the Error.getInitialProps function like it can in the getStaticProps function.
I
Expected Behavior
The documentation does not say that _error and 500 cannot be used together. So I would expect my custom 500 page to render just like my custom 400 page. There seems to be something else going on though since if I delete the custom 500 page, I get a plain white 500 page that just says
Internal Server Error
regardless of what content I return in my _error.tsx. And if I delete my _error.tsx, the behavior of my custom 500 is the same as described above.To Reproduce
404.tsx (works):
500.tsx (renders two outer divs, but all other content is replaced with message):
_error.tsx (Does not seem to render at all)
/test/error.tsx (Test error page):
The text was updated successfully, but these errors were encountered: