diff --git a/src/content/docs/en/guides/backend/google-firebase.mdx b/src/content/docs/en/guides/backend/google-firebase.mdx index 0eed9a33fef09..669ab4ff1010d 100644 --- a/src/content/docs/en/guides/backend/google-firebase.mdx +++ b/src/content/docs/en/guides/backend/google-firebase.mdx @@ -145,9 +145,19 @@ const serviceAccount = { client_x509_cert_url: import.meta.env.FIREBASE_CLIENT_CERT_URL, }; -export const app = activeApps.length === 0 ? initializeApp({ - credential: cert(serviceAccount as ServiceAccount), -}) : activeApps[0]; +const initApp = () => { + if (import.meta.env.PROD) { + console.info('PROD env detected. Using default service account.') + // Use default config in firebase functions. Should be already injected in the server by Firebase. + return initializeApp() + } + console.info('Loading service account from env.') + return initializeApp({ + credential: cert(serviceAccount as ServiceAccount) + }) +} + +export const app = activeApps.length === 0 ? initApp() : activeApps[0]; ``` :::note