From 6e7d5eb740313030b8fc21e7f44129948f58b29e Mon Sep 17 00:00:00 2001 From: Maxime Alza Date: Mon, 29 Jul 2024 15:34:18 +0200 Subject: [PATCH] Create function to initialize firebase --- translation-app-assessment/backend/cleanup/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translation-app-assessment/backend/cleanup/index.js b/translation-app-assessment/backend/cleanup/index.js index 93d3cc0..5df5cf3 100644 --- a/translation-app-assessment/backend/cleanup/index.js +++ b/translation-app-assessment/backend/cleanup/index.js @@ -33,7 +33,6 @@ const projectId = process.env.GCP_PROJECT // Call initializeFirebase during startup initializeFirebase(); -const firestore = firebaseAdmin.firestore() // Function to write monitoring "heartbeat" that cleanup has run const writeMonitoring = async () => { @@ -83,6 +82,7 @@ app.get('/', async (req, res) => { app.post('/', async (req, res, next) => { try { + const firestore = firebaseAdmin.firestore() await kpi() // Delete chat that have been expired for an hour or longer