From 95c936e54614aaa23e8f74fae5cddfa120dec5db Mon Sep 17 00:00:00 2001 From: hexcow Date: Tue, 25 Feb 2025 14:03:19 +0300 Subject: [PATCH] fix: fix getApps call for correct Firebase initialization --- .../tg-bot-starter/advanced-tg-bot/src/app/api/bot/route.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tg-bot-starter/advanced-tg-bot/src/app/api/bot/route.ts b/examples/tg-bot-starter/advanced-tg-bot/src/app/api/bot/route.ts index 76ed5d14..1fdb4f78 100644 --- a/examples/tg-bot-starter/advanced-tg-bot/src/app/api/bot/route.ts +++ b/examples/tg-bot-starter/advanced-tg-bot/src/app/api/bot/route.ts @@ -30,7 +30,7 @@ const firebaseConfig = { appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID, measurementId: process.env.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID, }; -const app = !getApps.length ? initializeApp(firebaseConfig) : getApp(); +const app = getApps().length === 0 ? initializeApp(firebaseConfig) : getApp(); const db = getFirestore(app); async function getOrCreateUserKeyPair(userId: string) { @@ -154,4 +154,4 @@ export const POST = async (req: Request) => { headers.set('x-vercel-background', 'true'); const handler = webhookCallback(bot, 'std/http'); return handler(req); -}; \ No newline at end of file +};