AFS 6.1.0 : Error: Firestore has already been started and its settings can no longer be changed.
See original GitHub issueAfter upgrading our project to 6.1.0 we started seeing this error
Version info
Angular: 11.0.1
Firebase: 8.0.2
AngularFire: 6.1.0
How to reproduce these conditions
import { AngularFirestoreModule, SETTINGS } from '@angular/fire/firestore';
@NgModule({
imports: [
AngularFirestoreModule,
AngularFireAuthModule,
AngularFireStorageModule,
AngularFireModule.initializeApp(environment.firebase),
],
providers: [
{
provide: SETTINGS,
useValue: { ignoreUndefinedProperties: true, cacheSizeBytes: 1048576 },
};
]
removing settings fixes the issue…
Debug output
Errors in the JavaScript console
FirebaseError: Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.
Expected behavior
no errors
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top Results From Across the Web
"Firebase Error : Firestore has already been started and its ...
"Firebase Error : Firestore has already been started and its settings can no longer be changed." connecting Firebase v9 with Firestore Emulator.
Read more >enablePersistence() throws "Firestore has already been ...
Firestore - enablePersistence() throws "Firestore has already been started and its settings can no longer be changed.
Read more >Firebase Admin Node.js SDK Release Notes - Google
This task no longer starts automatically unless the admin.database() API is explicitly invoked. Realtime Database. Rules management APIs now support the ...
Read more >Cloud Firestore - React Native Firebase
If you have started to receive a app:mergeDexDebug error after adding Cloud Firestore, please read the Enabling Multidex documentation for more information ...
Read more >@angular/fire | Yarn - Package Manager
AngularFire. The official Angular library for Firebase. ng add @angular/fire. AngularFire smooths over the rough edges an Angular developer might encounter ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Haha, I have been creating a repro for this the last 3 hours, to find a bug raised 2 hours ago…
The way the issue manifests itself for me is when I use a combination of Lazy-Loaded Routes AND providing injection token SETTINGS. In the component from the lazy-loaded route, the (new injected instance of) AngularFirestore is trying to apply settings again to the firebase object (see constructor of AngularFirestore.ts).
In the repro, using the following versions yields the expected result.
But breaks when using the following versions (and beyond)
IMHO, the AngularFirestore should be a singleton service.
Here is a repro: https://stackblitz.com/edit/firestore-lazy-module-bug-repro?devtoolsheight=33&file=readme.md
Hope this helps…
@jamesdaniels May you backport it to 6.0.x, please?