Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

354
Visualizações
Uncaught FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app). HTML and Javascript

I have seen many websites (which includes StackOverflow) about the same error with their solutions but none of them have worked for me.

I know that the error means that I've run a function using firebase before it was initialized.

Here are the relevant parts of my code:

        window.addPerson = addPerson;

        const queryString = window.location.search;
        const urlParams = new URLSearchParams(queryString);
        const userVar = urlParams.get('user')

        const userVarSplitted = userVar.split('#')
        const userVarFormatted = userVarSplitted[0] + ":" + userVarSplitted[1]

        // Import the functions you need from the SDKs you need
        import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.4/firebase-app.js";
        import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.6.4/firebase-analytics.js";
        import { getDatabase, ref, set } from "https://www.gstatic.com/firebasejs/9.1.0/firebase-database.js";
        // TODO: Add SDKs for Firebase products that you want to use
        // https://firebase.google.com/docs/web/setup#available-libraries

        // Your web app's Firebase configuration
        // For Firebase JS SDK v7.20.0 and later, measurementId is optional
        const firebaseConfig = {
            apiKey: "AIzaSyC6KGzXriv7IoQzcayPlzi-Xt_eRLgOqko",
            authDomain: "jerrybot-fa77f.firebaseapp.com",
            databaseURL: "https://jerrybot-fa77f-default-rtdb.europe-west1.firebasedatabase.app",
            projectId: "jerrybot-fa77f",
            storageBucket: "jerrybot-fa77f.appspot.com",
            messagingSenderId: "374262858544",
            appId: "1:374262858544:web:7971e56f62fab12631fef5",
            measurementId: "G-JQTEB5NDRE"
        };

        // Initialize Firebase
        const app = initializeApp(firebaseConfig);
        if (app.length === 0) {
            console.log("no firebas app")
        }else{
            console.log("initialized")
        }
        const analytics = getAnalytics(app);
        const db = getDatabase();

        function addPerson() {
            set(ref(db, "verified/" + userVarFormatted), {
                name: userVarSplitted[0],
                discriminator: userVarSplitted[1]
            });

            console.log("added")
        }

It does say Initialized in the console meaning the app exists. Do you know what's happening?

PS: The javascript type is set to module

Do you know what's happening? Thanks

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda