Firebase · sdk · fg-0184

admin.firestore is not a function after upgrading firebase-admin to v14

If you see TypeError: admin.firestore is not a function, the cause and the fix for Firebase are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
TypeError: admin.firestore is not a functionTypeError: Cannot read properties of undefined (reading 'cert') from admin.credential.certadmin.apps is undefined in an initializeApp guard
Cause
firebase-admin 14.0.0 removed the legacy namespace API, so the default import no longer carries firestore(), auth(), messaging(), credential, or apps. It also dropped Node.js 18 and 20.
Fix
Switch to the modular entry points (firebase-admin/app, /firestore, /auth, /messaging) and run on Node.js 22 or later.
Apply
import { initializeApp, getApps, cert } from 'firebase-admin/app'; import { getFirestore } from 'firebase-admin/firestore'; import { getAuth } from 'firebase-admin/auth'; const app = getApps()[0] ?? initializeApp({ credential: cert(serviceAccount) }); const db = getFirestore(app); const auth = getAuth(app);
Affected
firebase-admin 14.0.0 and later (released 2026-06-08); requires Node.js 22+
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun