Firebase in P5JS

Hey there, I want to use firebase in my project and I follow Shiffman’s project to do so, but I think the firebase configuration has changed…

in Shiffman’s HTML he wrote:

	<script src="https://www.gstatic.com/firebasejs/5.0.4/firebase.js"></script>

and in the JS:

// Initialize Firebase
  var config = {
    apiKey: "AIzaSyDPekCKX4ee6h9NVR2lEITGAM0XIHn-c7c",
    authDomain: "color-classification.firebaseapp.com",
    databaseURL: "https://color-classification.firebaseio.com",
    projectId: "color-classification",
    storageBucket: "",
    messagingSenderId: "590040209608"
  };
  firebase.initializeApp(config);
  database = firebase.database();
  authPromise = firebase.auth().signInAnonymously();

I just opened a new Firebase project and the configurations it shows me to copy are quite different from the video, they look like that:

<script type="module">
  // Import the functions you need from the SDKs you need
  import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.10/firebase-app.js";
  import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.6.10/firebase-analytics.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: "AIzaSyDP5vRnX9tY3SR8jEJe-rPVUqQ7KWRwwy4",
    authDomain: "my-project.firebaseapp.com",
    projectId: "my-project",
    storageBucket: "my-project.appspot.com",
    messagingSenderId: "706927492507",
    appId: "1:706927492507:web:d1k376f11b946120de4b04",
    measurementId: "G-9246EG98E6"
  };

  // Initialize Firebase
  const app = initializeApp(firebaseConfig);
  const analytics = getAnalytics(app);
</script>

And I can’t figure out what’s going to my HTML and what to my setup (I tried different options and got different errors).

another thing that is different than in Shiffman’s uses:

firebase.initializeApp(config);

and my Firebase says to do:

  const app = initializeApp(firebaseConfig);

any help would be amazing :smiling_face: