Skip to content

AngularFireModule has not been provided in your AppModule when lazy loading Firestore #3404

Open
@MawRojas

Description

@MawRojas

Version info

Angular: 15.2.9

Firebase: 9.8

AngularFire: 7.5

How to reproduce these conditions

Based on the sample advanced app. Firestore should be able to be lazy loaded.
I've created a getFiresotre file as the sample app indicates:

    import { getFirestore } from '@angular/fire/firestore';
    export const firestore = getFirestore();

The file is localed in the following path: src/app/getFirestore.ts
Then, I'm importing firestore just like the sample app:

    import { firestore } from 'src/app/getFirestore';

However, the getFirestore file throws the following error: Error: Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using provideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported)
The error makes sense, since I'm never providing Firestore in the app.module. However, the sample app does not provide it either.
I have inspected the sample app for the part of the code that provides firestore; nonetheless, I was not able to find it.
Was is the correct way of providing firestore while lazy loading it?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions