title: TypeError: firebase.auth(...).onAuthStateChanged is not a function
body: <p>I am trying to use the onAuthStateChanged trigger but I am getting "is not a function" when using "firebase deploy".
  when executing :</p>
  
  <pre><code>firebase deploy
  </code></pre>
  
  <p>I got the following error:</p>
  
  <pre><code>Error: Error occurred while parsing your function triggers.
  TypeError: firebase.auth(...).onAuthStateChanged is not a function
      at Object.&lt;anonymous&gt; (/home/ihab/Desktop/BlueDot/bluedot/functions/index.js:33:17)
      at Module._compile (module.js:643:30)
      at Object.Module._extensions..js (module.js:654:10)
      at Module.load (module.js:556:32)
      at tryModuleLoad (module.js:499:12)
      at Function.Module._load (module.js:491:3)
      at Module.require (module.js:587:17)
      at require (internal/module.js:11:18)
      at /usr/lib/node_modules/firebase-tools/lib/triggerParser.js:18:11
      at Object.&lt;anonymous&gt; (/usr/lib/node_modules/firebase-tools/lib&gt;/triggerParser.js:38:3)
      at Module._compile (module.js:643:30)
      at Object.Module._extensions..js (module.js:654:10)
      at Module.load (module.js:556:32)
      at tryModuleLoad (module.js:499:12)
      at Function.Module._load (module.js:491:3)
      at Function.Module.runMain (module.js:684:10)
  </code></pre>
  
  <p>I have also tried firebase.default.auth.onAuthStateChanged as mentionned in the solution posted by Joao Lopes in <a href="https://stackoverflow.com/questions/48592656/firebase-auth-is-not-a-function">this question</a> ut it gave the same error!</p>
  
  <p>I have already my domain added Firebase project>Authentication>Sign-In Method>Authorized Domains.</p>
  
  <p>I am using:Ubuntu 16.04,npm 5.6.0,Firebase Spark.
  Here is my package.json:</p>
  
  <pre><code>{
    "name": "functions",
    "description": "Cloud Functions for Firebase",
    "scripts": {
      "serve": "firebase serve --only functions",
      "shell": "firebase experimental:functions:shell",
      "start": "npm run shell",
      "deploy": "firebase deploy --only functions",
      "logs": "firebase functions:log"
    },
    "dependencies": {
      "consolidate": "^0.15.0",
      "express": "^4.16.2",
      "firebase-admin": "^5.8.2",
      "firebase-functions": "^0.8.1",
      "handlebars": "^4.0.11"
    },
    "private": true
  }
  </code></pre>
  
  <p>and my index.js:</p>
  
  <pre><code>const functions = require('firebase-functions');
  const firebase=require('firebase-admin');
  const express=require('express');
  const engines=require('consolidate'); 
  
  firebase.initializeApp(functions.config().firebase);
  
  
  const app=express();
  app.engine('hbs',engines.handlebars);
  app.set('views','./views');
  app.set('view engine','hbs');
  
  app.get('/',(req,res)=&gt;{
      res.render('index',{Loginsignup:"LoginSignup"});
  });
  
  /*Here is the probleme*/
  firebase.auth().onAuthStateChanged(function(user) {
       user.sendEmailVerification();
       if(!auth.currentUser.emailVerified){
           user.sendEmailVerification();
           console.log('signed in');
       }
  });
  /********************/
  
  exports.app = functions.https.onRequest(app);
  </code></pre>
  
  <p>So what am I missing?</p>