Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

345
Views
Firebase Realtime DB Query within HTML page - Uncaught ReferenceError: firebase is not defined

I am attempting to create a Push Notification Web tool for my iOS app. For now, all I am trying to do is query my Firebase Realtime database and console.log the values.

My hope was to be able to create an HTML doc, and integrate firebase using CDN and house all of that, along with my query in tags.

When I do this, I am getting an error in console that says "Uncaught ReferenceError: firebase is not defined"

Any idea what I am missing or why I am getting this error?

Here is what I have in my script tags:

<!DOCTYPE html><html lang="en">
<head></head>
<body>
<script type="module">
  // 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";
  // 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: "xxxx",
    authDomain: "xxx",
    databaseURL: "xxx",
    projectId: "xxx",
    storageBucket: "xxx",
    messagingSenderId: "xxx",
    appId: "xxx",
    measurementId: "G-xxx"
  };

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

  import { getDatabase } from "https://www.gstatic.com/firebasejs/9.6.4/firebase-database.js";
  const database = getDatabase();
</script>

<script>
//query database for ExpononentPushToken Values//

const dbRef = firebase.database().ref();
dbRef.child("push_token").child(userId).get().then((snapshot) => {
  if (snapshot.exists()) {
    console.log(snapshot.val());
  } else {
    console.log("No data available");
  }
}).catch((error) => {
  console.error(error);
});
</script>
</body>
</html>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!