Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting 'The timestampsInSnapshots setting now defaults to true' firestore error in console

I am getting the following error from Firestore in console, in Angular.

@firebase/firestore: Firestore (5.8.3): The timestampsInSnapshots setting now defaults to true and you no longer need to explicitly set it. In a future release, the setting will be removed entirely and so it is recommended that you remove it from your firestore.settings() call now.

Any suggestions, how to get rid of it?

like image 417
Marium Malik Avatar asked Feb 18 '19 10:02

Marium Malik


2 Answers

Go to your app.modules.ts file and add import:

import { FirestoreSettingsToken} from '@angular/fire/firestore';

Then add this value in your providers array:

providers: [{ provide: FirestoreSettingsToken, useValue: {} }]
like image 56
Anurag Arwalkar Avatar answered Sep 20 '22 17:09

Anurag Arwalkar


In general, we configure firebase in our app in the following way:

firebase.firestore().settings({
    timestampsInSnapshots: true
});

For the above configuration, It shows the following warning:

@firebase/firestore: Firestore (6.3.5): The timestampsInSnapshots setting now defaults to true and you no longer need to explicitly set it. In a future release, the setting will be removed entirely and so it is recommended that you remove it from your firestore.settings() call now.

In Order to resolve it, Just simply remove the timestampsInSnapshots attribute from the settings parameter. After fixing, your config should be changed to:

firebase.firestore().settings({});
like image 29
Jaideep Ghosh Avatar answered Sep 17 '22 17:09

Jaideep Ghosh