From d33a956155610d1c546da1439c79c3217ff8b910 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Thu, 6 Nov 2025 17:43:08 +0000 Subject: [PATCH] completionId: cgen-47a41c3781a24f6097d1fb254cabc888 cgen-47a41c3781a24f6097d1fb254cabc888 --- api/community/seed-demo.ts | 14 ++++++++++---- api/roblox-callback.ts | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/api/community/seed-demo.ts b/api/community/seed-demo.ts index 812597d7..800208f0 100644 --- a/api/community/seed-demo.ts +++ b/api/community/seed-demo.ts @@ -146,11 +146,17 @@ export default async function handler(req: VercelRequest, res: VercelResponse) { const seededUsers: any[] = []; for (const demoUser of DEMO_USERS) { - const { data: searchResult, error: searchError } = - await admin.auth.admin.listUsers({ email: demoUser.email }); - if (searchError) throw searchError; + let authUser: any; - let authUser = searchResult.users?.[0]; + try { + const { data: allUsers, error: searchError } = + await admin.auth.admin.listUsers(); + if (searchError) throw searchError; + + authUser = allUsers.users?.find((u: any) => u.email === demoUser.email); + } catch { + authUser = null; + } if (!authUser) { const tempPassword = `Demo${Math.random().toString(36).slice(2, 10)}!9`; const { data: createdUser, error: createError } = diff --git a/api/roblox-callback.ts b/api/roblox-callback.ts index cff4d488..b4a3b2fa 100644 --- a/api/roblox-callback.ts +++ b/api/roblox-callback.ts @@ -1,5 +1,5 @@ import type { VercelRequest, VercelResponse } from "@vercel/node"; -import { getAdminClient } from "./api/_supabase"; +import { getAdminClient } from "./_supabase"; export default async function handler(req: VercelRequest, res: VercelResponse) { if (req.method === "GET") {