Firebase: No Firebase App '[DEFAULT]' has been created - call initializeApp() first...

Discussão em 'Angular' iniciado por user28628241, Dezembro 20, 2024.

  1. user28628241

    user28628241 Guest

    FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call initializeApp() first (app/no-app).

    when the application is loaded my api try to get the firebase database but the app is not initizalized. How to wait the app to initialize before use api?

    imports: [
    AngularFireModule.initializeApp(environment.firebaseConfig),
    BrowserModule,
    AppRoutingModule,
    CoreModule,
    UserModule,
    AngularFireAuthModule,
    SharedModule,
    AdminModule,
    ReactiveFormsModule
    ],


    async getComputers() {
    const db = getFirestore()
    const colRef = collection(db, 'computers' );
    let computers: any[] = [];

    await getDocs(colRef).then((snapshot) => {

    snapshot.docs.forEach((doc) => {
    computers.push({ ...doc.data(), id: doc.id });

    })
    })

    return computers;
    }


    I need to initialize the firebase first then the component ask api for data.

    Continue reading...

Compartilhe esta Página