lundi 2 novembre 2020

Errors after deploying my flutter web app using Firebase Hosting

I've tried to deploy my web app but when I go the the public adress, I have some errors that i can't fix. (I'm testing on Firefox). I've asked my developper friends but they have no idea how to solve it.

my errors: enter image description here Uncaught ReferenceError: firebase is not defined

my index.html:

<!DOCTYPE html>
    
    <html>
    
      <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Couleurs Maroc WebApp</title>
    
        <!-- Favicon -->
        <link rel="icon" type="image/png" href="favicon.png"/>
        <link rel="manifest" href="manifest.json">
    
      </head>
      <body>
        <script type="application/javascript" src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.min.js"></script>
        <script type="application/javascript">
        pdfjsLib.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.worker.min.js";
        </script>
        <script defer type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-app.js"></script>
        <script defer type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-analytics.js"></script>
        <script defer type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-firestore.js"></script>
        <script defer type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-auth.js"></script>
        <script defer type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-storage.js"></script>
        <script defer src="/__/firebase/init.js"></script>
    
        <script>
        var firebaseConfig = {
          apiKey: "mykey",
          authDomain: "mydomain",
          databaseURL: "url",
          projectId: "id",
          storageBucket: "storage",
          messagingSenderId: "messagerid",
          appId: "appid",
          measurementId: "measurementid"
        };
        firebase.initializeApp(firebaseConfig);
        </script>
    
        <script>
          if ('serviceWorker' in navigator) {
            window.addEventListener('flutter-first-frame', function () {
              navigator.serviceWorker.register('flutter_service_worker.js');
            });
          }
        </script>
        <script type="application/javascript" src="main.dart.js"></script>
    
        <script>
          document.addEventListener('DOMContentLoaded', function() {
            const loadEl = document.querySelector('#load');
    
            try {
              let app = firebase.app();
              let features = [
                'auth', 
                'database', 
                'messaging', 
                'storage', 
                'analytics', 
                'remoteConfig',
                'performance',
              ].filter(feature => typeof app[feature] === 'function');
              loadEl.textContent = `Firebase SDK loaded with ${features.join(', ')}`;
            } catch (e) {
              console.error(e);
              loadEl.textContent = 'Error loading the Firebase SDK, check the console.';
            }
          });
        </script>
      </body>
    </html>

Thanks ! :D




Aucun commentaire:

Enregistrer un commentaire