Skip to content

AngularFirestore InjectionToken Error - Angular v13 + Firestore v7 #3088

Closed
@uiahhh

Description

@uiahhh

Version info

Angular:
13.0.3
Firebase:
9.4.0
AngularFire:
7.2.0
Other (operating system):
Windows 11 (build version 22000.348)

How to reproduce these conditions

Create a new angular project (using angular cli), then add angular fire (using angular cli)
Steps to set up and reproduce
ng new my-app
cd my-app
ng add @angular/fire (select Firestore option)
ng serve

Debug output

ERROR NullInjectorError: R3InjectorError(AppModule)[AngularFirestore -> InjectionToken angularfire2.app.options -> InjectionToken angularfire2.app.options -> InjectionToken angularfire2.app.options]:
NullInjectorError: No provider for InjectionToken angularfire2.app.options!
at NullInjector.get (core.mjs:11120)
at R3Injector.get (core.mjs:11287)
at R3Injector.get (core.mjs:11287)
at R3Injector.get (core.mjs:11287)
at injectInjectorOnly (core.mjs:4767)
at Module.ɵɵinject (core.mjs:4771)
at Object.AngularFirestore_Factory [as factory] (angular-fire-compat-firestore.js:584)
at R3Injector.hydrate (core.mjs:11457)
at R3Injector.get (core.mjs:11276)
at NgModuleRef.get (core.mjs:21814)

Expected behavior

Get data from Firestore.

Actual behavior

Cannot get data from Firestore.

Current workaround

Replace "provideFirestore(() => getFirestore())," by "AngularFireModule.initializeApp(environment.firebase)," on AppModule.

Metadata

Metadata

Assignees

No one assigned

    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