diff --git a/apps/web/src/pages/invite/[urlId].tsx b/apps/web/src/pages/invite/[urlId].tsx index 838e7eb93f5..9e4336771ae 100644 --- a/apps/web/src/pages/invite/[urlId].tsx +++ b/apps/web/src/pages/invite/[urlId].tsx @@ -184,7 +184,7 @@ export const getStaticPaths = async () => { export const getStaticProps: GetStaticProps = async (ctx) => { // We get these props to be able to render the og:image - const poll = await prisma.poll.findUniqueOrThrow({ + const poll = await prisma.poll.findUnique({ where: { id: ctx.params?.urlId as string, }, @@ -199,6 +199,10 @@ export const getStaticProps: GetStaticProps = async (ctx) => { }, }); + if (!poll) { + return { props: {}, notFound: 404 }; + } + const res = await getStaticTranslations(ctx); if ("props" in res) {