From dc4404f88cb37e4a038fdb850ffb16872f57a05c Mon Sep 17 00:00:00 2001 From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Date: Thu, 22 Jan 2026 20:29:53 +0530 Subject: [PATCH] fix: ensure verification token has team before processing (#27139) * ensure verification token has team before processing * fix --- apps/web/lib/signup/getServerSideProps.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/web/lib/signup/getServerSideProps.tsx b/apps/web/lib/signup/getServerSideProps.tsx index 617c48fb5a..2596a24eb4 100644 --- a/apps/web/lib/signup/getServerSideProps.tsx +++ b/apps/web/lib/signup/getServerSideProps.tsx @@ -156,9 +156,18 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => { let username = guessUsernameFromEmail(verificationToken.identifier); + if (!verificationToken?.team) { + return { + redirect: { + permanent: false, + destination: `/auth/error?error=Verification Token is not associated with any team`, + }, + } as const; + } + const tokenTeam = { - ...verificationToken?.team, - metadata: teamMetadataSchema.parse(verificationToken?.team?.metadata), + ...verificationToken.team, + metadata: teamMetadataSchema.parse(verificationToken.team.metadata ?? null), }; const isATeamInOrganization = tokenTeam?.parentId !== null;