title: Firebase serve --only functions VS local emulator to run cloud functions locally?
body: <p>Up until now I've been doing the following to use and test my functions locally during development:</p>
  
  <p>I leave this running in one terminal:</p>
  
  <p><code>firebase serve --only functions</code></p>
  
  <p>And I add this on my client code when I'm initializing my Firebase app:</p>
  
  <pre><code>const config = {
    apiKey: process.env.FIREBASE_APP_API_KEY,
    authDomain: process.env.FIREBASE_APP_AUTH_DOMAIN,
    databaseURL: process.env.FIREBASE_APP_DATABASE_URL,
    projectId: process.env.FIREBASE_APP_PROJECT_ID,
    storageBucket: process.env.FIREBASE_APP_STORAGE_BUCKET,
    messagingSenderId: process.env.FIREBASE_APP_MESSAGING_SENDER_ID
  };
  
  firebase.initializeApp(config);
  
  // THIS IS THE DEFAULT HOST AND PORT USED BY 'firebase serve command'
  firebase.functions().useFunctionsEmulator('http://localhost:5000');
  </code></pre>
  
  <p><strong>I have tested only HTTP callable functions and so far this has been working fine.</strong></p>
  
  <hr>
  
  <p><strong>But in the docs, I see this:</strong></p>
  
  <p><a href="https://firebase.google.com/docs/functions/local-emulator" rel="noreferrer">https://firebase.google.com/docs/functions/local-emulator</a></p>
  
  <blockquote>
    <p>Run functions locally
    The Firebase CLI includes a Cloud Functions emulator which can emulate the following function types:</p>
    
    <ul>
    <li>HTTPS functions</li>
    <li>Callable functions</li>
    <li>Cloud Firestore functions</li>
    </ul>
    
    <p>You can run functions locally to test them before deploying to production.</p>
    
    <p><strong>1. Install the Firebase CLI</strong> - <a href="https://firebase.google.com/docs/functions/local-emulator#install_the_firebase_cli" rel="noreferrer">Link</a></p>
    
    <p><strong>2. Set up admin credentials (optional)</strong> - <a href="https://firebase.google.com/docs/functions/local-emulator#set_up_admin_credentials_optional" rel="noreferrer">Link</a></p>
  
  <pre><code>$ set GOOGLE_APPLICATION_CREDENTIALS=path\to\key.json
  $ firebase emulators:start
  </code></pre>
    
    <p>After completing these steps, your functions tests can access Firebase and Google APIs using the Admin SDK. For example, when testing an Authentication trigger, the emulated function could call admin.auth().getUserByEmail(email).</p>
  </blockquote>
  
  <p><strong>QUESTION</strong></p>
  
  <p>What is the difference between the two methods of running functions locally?</p>