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

476
Views
TypeError: firebaseApp.firestore is not a function
const db=firebaseApp.firestore();
export default db;

the error occurs in this line of code Ive tried importing everything and every possible method but still the error shows up everytime.

the full code is

import * as firebase from "firebase/app";
//import firebase from 'firebase/app';
import "firebase/firestore";
import 'firebase/auth';

// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseApp = firebase.initializeApp({
    apiKey: "",
    authDomain: "",
    databaseURL: '',
    projectId: "",
    storageBucket: "",
    messagingSenderId: "",
    appId: "",
    measurementId: ""
  });
  const db=firebaseApp.firestore();
  export default db;  
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It seems you are using Firebase Modular SDK V9.0.0+ which has a completely new syntax. If you wish to use existing syntax, change your imports to compat version:

import firebase from "firebase/compat/app";
import "firebase/compat/firestore";
import 'firebase/compat/auth';

However I'd recommend upgrading to Modular SDK syntax because has supports tree-shaking and will be lighter than existing version. Checkout this Firecast to learn more about new syntax for Firestore:

Getting started with Cloud Firestore for Web

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!