From 50f1fe544e7cb0e8d875cd114d73c3519a0a1e4c Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Wed, 11 May 2022 11:11:09 +0530 Subject: [PATCH] Improve logs and Fix unwanted 500 to reduce noise in logs (#2674) * Improve logs * Fix unintentional 500 Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/web/pages/[user]/book.tsx | 9 +++++++-- apps/web/pages/api/app-store/installed.ts | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/web/pages/[user]/book.tsx b/apps/web/pages/[user]/book.tsx index ec255ab72c..7b5aa8a7be 100644 --- a/apps/web/pages/[user]/book.tsx +++ b/apps/web/pages/[user]/book.tsx @@ -94,6 +94,13 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { if (!users.length) return { notFound: true }; const [user] = users; + const isDynamicGroupBooking = users.length > 1; + + // Dynamic Group link doesn't need a type but it must have a slug + if ((!isDynamicGroupBooking && !context.query.type) || (isDynamicGroupBooking && !eventTypeSlug)) { + return { notFound: true }; + } + const eventTypeRaw = usernameList.length > 1 ? getDefaultEvent(eventTypeSlug) @@ -173,8 +180,6 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { booking = await getBooking(prisma, context.query.rescheduleUid as string); } - const isDynamicGroupBooking = users.length > 1; - const dynamicNames = isDynamicGroupBooking ? users.map((user) => { return user.name || ""; diff --git a/apps/web/pages/api/app-store/installed.ts b/apps/web/pages/api/app-store/installed.ts index 77aa3b1a57..24eb22c9ae 100644 --- a/apps/web/pages/api/app-store/installed.ts +++ b/apps/web/pages/api/app-store/installed.ts @@ -25,6 +25,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) res.status(404); } } catch (error) { + console.log(error); res.status(500); } } else {