-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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 occurred prerendering page "/500" #23128
Comments
We have the same issue when building in our CI environment, although it works locally when running |
guys @scottbert , @vendramini , it happens to me also. To get around this you should make a new file at function Error({ statusCode }) {
return (
<p>
{statusCode
? `An error ${statusCode} occurred on server`
: 'An error occurred on client'}
</p>
)
}
Error.getInitialProps = ({ res, err }) => {
const statusCode = res ? res.statusCode : err ? err.statusCode : 404
return { statusCode }
}
export default Error @vendramini Next try to generate a static 500 in build time, not a dynamic one. So I think you need to edit the description. |
@Doaa-Ismael hey! Thank you for the answer, but it didn't solve the problem :( I'm getting the same error. [=== ] info - Generating static pages (0/1)
Error occurred prerendering page "/500". Read more: https://err.sh/next.js/prerender-error
TypeError: Cannot read property 'isAndroid' of undefined
|
I think the issue it's pretty much the same as mine, so the steps are quite simple, it's happening when running
|
Saw the same issue and went to 10.0.6 as @lapa182 suggests and it works fine. |
Sorry for the lateness to respond. I also "fixed" it by doing pretty much what @Doaa-Ismael suggested. |
Got the same error after upgrading from 10.0.7 to 10.0.9. Our old code of
The variation from @Doaa-Ismael helped, although I don't understand why the logic is like this now.
|
Since my issue was closed and this one requires reproduction, it is here: https://github.com/laSinteZ/nextjs-10-1-error-500 |
This comment has been minimized.
This comment has been minimized.
Similar issue on our end too:
We copied the exact code from here to make sure it is not failing because of us and we still get the same error. |
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.0.9
What version of Node.js are you using?
12.16.3
What browser are you using?
Chrome
What operating system are you using?
Linux Mint
How are you deploying your application?
next start
Describe the Bug
After upgrading to next 10.0.9 (I was using 10.0.5) during the build phase it is trying to create a 500 page I suppose. In my application it's not possible, I've a complex
_app.getInitialProps
so I tried to create a 500.js (#22887). It's still trying to create a 500 page, my static 500.js is ignored.Expected Behavior
Use my static 500.js.
To Reproduce
I've some logic in my _getInitialProps. Everything works in next 10.0.5, but in 10.0.9 I can't compile anymore.
The text was updated successfully, but these errors were encountered: