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) {