Aaron-Sterling / extended-angular-firestore

Lightweight extension of Angular Firestore. Provides a more intuitive API. Create, Update, Add-or-Update (Upsert), Check for Existence, Download Once, Download and Listen for Changes.
1 stars 1 forks source link

StaticInjectorError during ExtendedFirestoreModule.forRoot() #1

Open harleybl opened 6 years ago

harleybl commented 6 years ago

Hello,

I am attempting to use the ExtendedAngularFirestoreModule.forRoot() and am getting the following error. Previously using AngularFireModule.initializeApp worked fine.

I also have AngularFIreAuthModule in my imports. Should I still be doing that? When I remove that I get a different injector error that it cannot find AngularFIreAuth.

Here is the error: null: ERROR null: Error: StaticInjectorError(AppModule)[FirebaseApp -> InjectionToken FirebaseAppConfigToken]: message: "StaticInjectorError(AppModule)[FirebaseApp -> InjectionToken FirebaseAppConfigToken]: StaticInjectorError(Platform: core)[FirebaseApp -> InjectionToken FirebaseAppConfigToken]: NullInjectorError: No provider for InjectionToken FirebaseAppConfigToken!" ngDebugContext: DebugContext_ {view: Object, nodeIndex: 1, nodeDef: Object, …} ngErrorLogger: function () { … } ngTempTokenPath: null ngTokenPath: Array(2) ["FirebaseApp", InjectionToken] stack: "Error: StaticInjectorError(AppModule)[FirebaseApp -> InjectionToken FirebaseAppConfigToken]: StaticInjectorError(Platform: core)[FirebaseApp -> InjectionToken FirebaseAppConfigToken]: NullInjectorError: No provider for InjectionToken FirebaseAppConfigToken! at _NullInjector.get (http://localhost:8100/build/vendor.js:1376:19) at resolveToken (http://localhost:8100/build/vendor.js:1674:24) at tryResolveToken (http://localhost:8100/build/vendor.js:1616:16) at StaticInjector.get (http://localhost:8100/build/vendor.js:1484:20) at resolveToken (http://localhost:8100/build/vendor.js:1674:24) at tryResolveToken (http://localhost:8100/build/vendor.js:1616:16) at StaticInjector.get (http://localhost:8100/build/vendor.js:1484:20) at resolveNgModuleDep (http://localhost:8100/build/vendor.js:11224:25) at _callFactory (http://localhost:8100/build/vendor.js:11288:28) at _createProviderInstance$1 (http://localhost:8100/build/vendor.js:11238:26)"

Here are the relevant sections of my package.json file:

"dependencies": { "@angular/animations": "^5.2.5", "@angular/common": "^5.2.5", "@angular/compiler": "^5.2.5", "@angular/core": "^5.2.5", "@angular/forms": "^5.2.5", "@angular/http": "^5.2.5", "@angular/platform-browser": "^5.2.5", "@angular/platform-browser-dynamic": "^5.2.5", "@angular/router": "^5.2.5", "@angular/tsc-wrapped": "^4.4.6", "@ionic-native/app-availability": "^4.2.1", "@ionic-native/contacts": "^4.2.1", "@ionic-native/core": "^3.14.0", ... "angularfire2": "^5.0.0-rc.4", "core-js": "^2.4.1", "extended-angular-firestore": "^1.0.0", "firebase": "^4.9.0", "ionic": "^3.9.2", "ionic-angular": "^3.8.0", ... }, "devDependencies": { "@angular/cli": "1.6.5", "@angular/compiler-cli": "^5.2.0", "@angular/language-service": "^5.2.0", "@ionic/app-scripts": "^3.0.1", "ionic": "3.19.1", ... "typescript": "~2.4.2", "webpack": "^2.2.1" },

Aaron-Sterling commented 6 years ago

The order of modules matters. Put this module earlier than the AFAuth module.

harleybl commented 6 years ago

It was ahead of that. Here is what my imports block is.

imports: [ BrowserModule, IonicModule.forRoot(MyApp), IonicStorageModule.forRoot(), ExtendedAngularFirestoreModule.forRoot(ENV.firebaseConfig), //AngularFireModule.initializeApp(ENV.firebaseConfig), AngularFireAuthModule, FormsModule, ReactiveFormsModule, HttpModule ],

Aaron-Sterling commented 6 years ago

I see what you're saying. It looks as though this is coming up a lot - between af/database, and af/database-deprecated. I'm going to need a day or two to figure this out.