From 4eef997d632e917077d458bf35e85c83edfeff2d Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Fri, 6 Feb 2026 23:02:25 +0100 Subject: [PATCH] fix: onboarding errors --- apps/web/src/app/(ui)/(public)/onboarding/page.tsx | 5 ++++- apps/web/src/lib/form/actions.ts | 4 ++-- apps/web/src/lib/instrumentation/streamInfo.ts | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/web/src/app/(ui)/(public)/onboarding/page.tsx b/apps/web/src/app/(ui)/(public)/onboarding/page.tsx index c71fde8..140fd9c 100644 --- a/apps/web/src/app/(ui)/(public)/onboarding/page.tsx +++ b/apps/web/src/app/(ui)/(public)/onboarding/page.tsx @@ -4,7 +4,10 @@ import OnboardingClient from "./page.client"; export default async function Page() { const { user } = await validateRequest(); - if (user!.hasOnboarded) { + if (!user) { + return redirect('/'); + } + if (user.hasOnboarded) { return redirect('/'); } return ; diff --git a/apps/web/src/lib/form/actions.ts b/apps/web/src/lib/form/actions.ts index 801c454..85a5dce 100644 --- a/apps/web/src/lib/form/actions.ts +++ b/apps/web/src/lib/form/actions.ts @@ -105,8 +105,8 @@ export async function onboard(prev: any, formData: FormData) { await generateStreamKey(createdChannel.id, createdChannel.name); - if (process.env.NODE_ENV === 'production') { - await fetch(process.env.WELCOME_WORKFLOW_URL!, { + if (process.env.NODE_ENV === 'production' && process.env.WELCOME_WORKFLOW_URL) { + await fetch(process.env.WELCOME_WORKFLOW_URL, { method: 'POST', body: JSON.stringify({ username: zod.data.username, diff --git a/apps/web/src/lib/instrumentation/streamInfo.ts b/apps/web/src/lib/instrumentation/streamInfo.ts index f1a6227..fbac07e 100644 --- a/apps/web/src/lib/instrumentation/streamInfo.ts +++ b/apps/web/src/lib/instrumentation/streamInfo.ts @@ -49,6 +49,10 @@ export async function initializeStreamInfo(channelId?: string) { export async function syncStream() { try { + if (!process.env.MEDIAMTX_API) { + console.error('MEDIAMTX_API environment variable is not set'); + return; + } const response = await fetch(`${process.env.MEDIAMTX_API}/v3/paths/list?itemsPerPage=1000`); if (!response.ok) {