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

287
Views
Console error message Firebase.database() is not a function

I am trying to implement a server-side countdown with firebase with the TIMESTAMP function, however despite following the documentation provided by firebase and also a post about this a while back (How to implement a distributed countdown timer in Firebase), the console keeps telling me that firebase.database() is not a function:

// Import the functions you need from the SDKs you need
import { initializeApp} from "https://www.gstatic.com/firebasejs/9.8.1/firebase-app.js";
import { getDatabase, ref, onValue, update, get, set} from "https://www.gstatic.com/firebasejs/9.8.1/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
const firebaseConfig = {
  apiKey: "AIzaSyDZY8ufwFMkPhzOY-dNJm9bGXqv9okoW5g",
  authDomain: "f1-crypto.firebaseapp.com",
  databaseURL: "https://f1-crypto-default-rtdb.asia-southeast1.firebasedatabase.app",
  projectId: "f1-crypto",
  storageBucket: "f1-crypto.appspot.com",
  messagingSenderId: "512980395232",
  appId: "1:512980395232:web:9d81bc5d7c58bc5a13dc85"
};

// Initialize Firebase
const firebase = initializeApp(firebaseConfig);
const database = firebase.database();
const reff = database.ref("countdown");
reff.set({
  startAt: ServerValue.TIMESTAMP,
  seconds: 20
});
Uncaught TypeError: firebase.database is not a function

Documentation for this timestamp countdown is pretty scarce as well so any help would be greatly appreciated

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

const database = getDatabase();

Have you tried this?

about 4 years ago · Juan Pablo Isaza Report
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!