title: Firebase: firebase.messaging() is not a function
body: <p>I am trying to set up <code>NodeJS Client Web App</code> from <code>FCM</code>. I have setup <code>firebase-admin</code> on the server side. While setting up the client to access tokens I am getting a <code>TypeError: firebase.messaging is not a function</code> error. From other solutions it seems like a compatibilty error between different FCM versions but still could fix it. Below is the html file I am using</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
      &lt;script src="https://www.gstatic.com/firebasejs/3.1.0/firebase.js"&gt;&lt;/script&gt;
  
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
    &lt;script&gt;
      console.log(firebase);
  
      const messaging = firebase.messaging();
      messaging.onTokenRefresh(function () {
        messaging.getToken()
          .then(function (refreshedToken) {
            console.log('Token refreshed.');
            console.log(refreshedToken);
            // // Indicate that the new Instance ID token has not yet been sent to the
            // // app server.
            // setTokenSentToServer(false);
            // // Send Instance ID token to app server.
            // sendTokenToServer(refreshedToken);
            // // [START_EXCLUDE]
            // // Display new Instance ID token and clear UI of all previous messages.
            // resetUI();
            // // [END_EXCLUDE]
          })
          .catch(function (err) {
            console.log('Unable to retrieve refreshed token ', err);
            // showToken('Unable to retrieve refreshed token ', err);
          });
      });
    &lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>How to correctly set up firebase on the client side?
  EDIT: <code>console.log(firebase)</code> gives :</p>
  
  <pre><code>SDK_VERSION: "3.1.0", initializeApp: ƒ, app: ƒ, Promise: ƒ, …}
  INTERNAL:{registerService: ƒ, createFirebaseNamespace: ƒ, extendNamespace: ƒ, createSubscribe: ƒ, ErrorFactory: ƒ, …}
  Promise:ƒ Promise()
  SDK_VERSION : "3.1.0"
  User:ƒ (a,b,c)
  app:ƒ a(a)
  apps:(...)
  auth:ƒ (c)
  database:ƒ (c)
  initializeApp:ƒ (a,c)
  storage:ƒ (c)
  get apps:ƒ ()
  __proto__
  :
  Object
  </code></pre>