title: How to use Firebase Cloud Functions with the new modular Firestore API?
body: <p>I have upgraded my Firebase v8 project to v9. The web application now uses the modular SDK with the new functional API for Firestore.</p>
  <p>In this project I use Firebase Functions. There I have upgraded to firebase-admin 11.0.0. But it seams it does not provide the new functional API for Firestore.</p>
  <pre><code>const { initializeApp } = require('firebase-admin/app');
  const app = initializeApp();
  
  import { getFirestore } from &quot;firebase/firestore&quot;;
  const db = getFirestore(app);
  </code></pre>
  <p>This throws:</p>
  <pre><code>TypeError: Cannot read properties of undefined (reading 'getProvider')
    at Object._getProvider (/p/happygast/node_modules/@firebase/app/src/internal.ts:110:6)
    at Object.getFirestore (/p/happygast/node_modules/@firebase/firestore/src/api/database.ts:185:10)
  </code></pre>
  <p>Now I am not sure if I am doing something wrong? Or is there no functional Firestore API for Cloud Functions?</p>
  <p>In essence: Is <code>firebase-admin/app</code> compatible with <code>firebase/firestore</code>? Or: How do I initialize and use <code>firebase/firestore</code> in Firebase Cloud Functions?</p>