fix: onboarding errors

This commit is contained in:
2026-02-06 23:02:25 +01:00
parent 7574b94933
commit 4eef997d63
3 changed files with 10 additions and 3 deletions

View File

@@ -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 <OnboardingClient />;

View File

@@ -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,

View File

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