-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Fix next.js building 500 statically, see vercel/next.js#23128
- Loading branch information
1 parent
168e735
commit 56f400a
Showing
2 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Overwriting _error page since not doing so would trigger static site | ||
// generation of 500 which would call `_app.getInitialProps` which would then | ||
// try to access some URL which isn't necessary online during the build, | ||
// breaking the build. | ||
// See https://github.com/vercel/next.js/issues/23128 | ||
|
||
function Error() { | ||
return <p>An error occurred on client</p>; | ||
} | ||
|
||
Error.getInitialProps = ({ res, err }) => { | ||
const statusCode = res ? res.statusCode : err ? err.statusCode : 404; | ||
return { statusCode }; | ||
}; | ||
|
||
export default Error; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters