*Angular:5.2.10
*Firebase:4.13.0
**AngularFire:5.0.0-rc.5-next
* Errors in the JavaScript console *
* Screenshots *

Steps to set up and reproduce
For now, i solve it like this;
https://firebase.google.com/support/release-notes/js
export class CoreModule {
constructor( ...,
private afs: AngularFirestore) {
const settings = {timestampsInSnapshots: true};
afs.app.firestore().settings(settings);
...
}
}
I am not able to use your temporary solution when i have AngularFirestoreModule.enablePersistence()
Error i get:
ERROR Error: Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.
I have the same issue and the temporary fix didn't work for me
Sorry it's working, just put it in the config too and had to remove it from there:
var firebaseConfig = {
...
timestampsInSnapshots: true
};
the same problem as @tgangso
@tgangso
I have the same issue here.
Please have more details of how is it working. I've checked FirebaseAppConfig interface
and it seems not having "timestampsInSnapshots"
export interface FirebaseAppConfig {
apiKey?: string;
authDomain?: string;
databaseURL?: string;
storageBucket?: string;
messagingSenderId?: string;
projectId?: string;
}
I use the code below:
AngularFireModule.initializeApp({...firebaseconfig, timestampsInSnapshots: true}),
and it's not working. Please let me know how to add correct config to it. Thank you.
try something like this:
@NgModule( {
imports: [
...,
AngularFireModule.initializeApp( environment.firebase, 'XXX' ),
],
declarations: [
...
],
providers: [
...
]
} )
export class CoreModule {
constructor( @Optional() @SkipSelf() parentModule: CoreModule,
private afs: AngularFirestore ) {
const settings = { timestampsInSnapshots: true };
afs.app.firestore().settings( settings );
...
}
}
if u need, use AppModule instead of CoreModule
@egaviriarestrepo
Thank you, but my issue is that our app need to enable offline support.
So if I add "AngularFirestoreModule.enablePersistence(),"
I will get this error:
console.error: Unhandled Promise rejection: Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.
`
@NgModule( {
imports: [
...,
AngularFireModule.initializeApp( environment.firebase, 'XXX' ),
AngularFirestoreModule.enablePersistence(),
],
declarations: [
...
],
providers: [
...
]
} )
export class CoreModule {
constructor( @Optional() @SkipSelf() parentModule: CoreModule,
private afs: AngularFirestore ) {
const settings = { timestampsInSnapshots: true };
afs.app.firestore().settings( settings );
...
}
}
`
you can try, but i dont know if it work :
afs.app.firestore().settings( settings );
afs.app.firestore().enablePersistence();
and comment:
AngularFirestoreModule.enablePersistence()
@egaviriarestrepo
Thank you, it works.
Import AngularFirestoreModule instead of AngularFirestoreModule.enablePersistence() then it's working.
@egaviriarestrepo Thank you made it work also like @nathanfan46 sais you have to remove enablePersistence from module load.
This solution isn't working for me. I've modified my app.module.ts to look like this:
import { AngularFirestoreModule, AngularFirestore } from 'angularfire2/firestore';
...
imports: [
...,
AngularFireModule.initializeApp(environment.firebase, 'test-app'),
AngularFirestoreModule
]
...
export class AppModule {
constructor( @Optional() @SkipSelf() parentModule: AppModule,
private afs: AngularFirestore ) {
const settings = { timestampsInSnapshots: true };
afs.app.firestore().settings( settings );
}
}
But I get the error error TS2339: Property 'app' does not exist on type 'AngularFirestore'.
@ziftytodd Try afs.firestore.settings({timestampsInSnapshots: true});, that's what worked for me when I got that error.
Just
import { AngularFirestoreModule, AngularFirestore } from 'angularfire2/firestore';
in your app.module
then also in your app.module
export class AppModule {
constructor(private afs: AngularFirestore) {
afs.firestore.settings({
timestampsInSnapshots: true,
});
afs.firestore.enablePersistence();
}
}
And we are fine since the dependency injector will always inject the configured instance
thanks for all the suggestions. This one is working for me
(Angular 6)
Fixed in angularfire2@next
Thank you so much @SaHeinem , worked well for me!!!
and if I have active AngularFireAuthModule
imports: [
...
AngularFireModule.initializeApp(firebaseConfig),
// AngularFirestoreModule.enablePersistence(),
AngularFireAuthModule,
...
],
export class AppModule {
constructor(private afs: AngularFirestore) {
afs.firestore.settings({
timestampsInSnapshots: true,
});
afs.firestore.enablePersistence();
}
}
Doesn't work for me with [email protected].
I get:
"ERROR Error: Uncaught (in promise): FirebaseError: [code=failed-precondition]: Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object"
The same rearranging to enable persistence before applying settings: "Firestore already started, and settings cannot be changed anymore..."
I'm in a loop and cannot update to >rc.7 due to other dependencies in project not yet updated to use firebase >5.0.0
Any help?
Most helpful comment
you can try, but i dont know if it work :
and comment:
AngularFirestoreModule.enablePersistence()