Skip to content

Commit

Permalink
[WIP] Fix next.js building 500 statically, see vercel/next.js#23128
Browse files Browse the repository at this point in the history
  • Loading branch information
timhabermaas committed May 19, 2021
1 parent 168e735 commit 56f400a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions frontend/pages/_error.js
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;
1 change: 1 addition & 0 deletions frontend/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function Announcement(props: AnnouncementProps) {

export default function Home(props: HomeProps) {
const { data } = useAnnouncement();

return (
<Layout jwtToken={props.jwtToken} page={"Home"}>
{data && (
Expand Down

0 comments on commit 56f400a

Please sign in to comment.