From ef5298664cc388bb61cb41ef41077d325fb8e2ad Mon Sep 17 00:00:00 2001 From: Dom Sip Date: Thu, 24 Mar 2022 11:02:19 +0000 Subject: [PATCH] return 404 for invalid page --- site/pages/[...pages].tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/site/pages/[...pages].tsx b/site/pages/[...pages].tsx index a8a24b3aa..ddbd82a79 100644 --- a/site/pages/[...pages].tsx +++ b/site/pages/[...pages].tsx @@ -38,8 +38,9 @@ export async function getStaticProps({ const page = data?.page if (!page) { - // We throw to make sure this fails at build time as this is never expected to happen - throw new Error(`Page with slug '${slug}' not found`) + return { + notFound: true, + } } return {