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

162
Views
Next.js & Firebase -> TypeError: Cannot read properties of undefined (reading 'apps')

what I am trying to do, is to code an auth. with NextJS and Firebase.

Now the problem appears in my firebaseClient.js, where I get the error "TypeError: Cannot read properties of undefined (reading 'apps')".

The code looks like this:

import firebase from "firebase/app";

import "firebase/auth";
import "firebase/database";

const FIREBASE_CONFIG = {
  // config files from firebase here
};

export default function firebaseClient() {
  if (!firebase.apps.length) {
    firebase.initializeApp(FIREBASE_CONFIG);
  }
}

In the console I get this error: Terminal Error

This appears on the localhost:3000: Error Page on localhost:3000

I am following this YT tutorial here , which is from 2020, so some imports, as far as I can tell, changed.

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

0

It seems your code has firebase v8 while you have firebase v9 package and it has completely different import structures. This happen lot when you follow some tutorials with v8 and install firebase so it get latest version on default that's v9

What should you do:

1- Remove current version

npm rm firebase

2- install latest of 8.x

npm install firebase@8.9

about 4 years ago · Juan Pablo Isaza Report

0

I found a tutorial, and the video reproduces 100% of the errors you get with the outdated v8 firebase version. I followed the tutorial and it actually works, and when adapting the code to firebase v9, it runs again.
YouTube Video

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!