From f1e5e0ad5a25df0924cd0194578d69f247efc100 Mon Sep 17 00:00:00 2001 From: Eugene Toder Date: Tue, 26 Nov 2024 00:59:37 -0500 Subject: [PATCH] Don't pass an empty config, pass nothing (#36) --- functions/src/index.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/functions/src/index.ts b/functions/src/index.ts index 1310621..8a15b8f 100644 --- a/functions/src/index.ts +++ b/functions/src/index.ts @@ -1,15 +1,18 @@ import * as functions from "firebase-functions"; import * as admin from "firebase-admin"; -admin.initializeApp( + +if (process.env.FUNCTIONS_EMULATOR) { // We don't pass any configs, so admin SDK queries firebase API to get them. // This works if the user is logged in and has access, but we don't want to // require this for local development. Passing just the databaseURL seems to // be enough. The default db name is just "setwithforks-dev". Once we have // prod set up, we can rename the dev db and remove this code. - process.env.FUNCTIONS_EMULATOR - ? { databaseURL: "https://setwithforks-dev-default-rtdb.firebaseio.com" } - : {} -); + admin.initializeApp({ + databaseURL: "https://setwithforks-dev-default-rtdb.firebaseio.com", + }); +} else { + admin.initializeApp(); +} import Stripe from "stripe"; const stripe = !functions.config().stripe