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 = {MY_CONFIG};

        // Initialize Firebase
        const app = initializeApp(firebaseConfig);
        const analytics = getAnalytics(app);
        const db = getDatabase();

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

            console.log("added")
        }

PS: The javascript type is set to module

Do you know what’s happening?
Thanks