I've upgraded my project to the last firebase SDK version (5.7.x => 5.8.2) and my code doesn't work anymore. Here is the stacktrace on the screen :

import * as firebase from "firebase/app";
import "firebase/auth";
import "firebase/database";
import "firebase/firestore";
import "firebase/functions";
// Masked because there are my personel credentials
const config = {
...
};
if (!firebase.apps.length) {
firebase.initializeApp(config);
}
const settings = {/* your settings... */ timestampsInSnapshots: true};
firebase.firestore().settings(settings);
export default firebase;
I know there is a breaking API change for timestamps, as I can see in the release note here: https://firebase.google.com/support/release-notes/js#5.8.0
Even if I remove the line firebase.firestore().settings(settings);, the same error occured later in my app.
I had to do these changes in my app to make it work again:
import firebase from "@firebase/app";
import "@firebase/auth";
import "@firebase/database";
import "@firebase/firestore";
import "@firebase/functions";
// Masked because there are my personel credentials
const config = {
...
};
if (!firebase.apps.length) {
firebase.initializeApp(config);
}
export default firebase;
Do you have any idea why I would have to change many code ? Is it normal ?
Here is a related issue I opened in FirebaseUI repository : https://github.com/firebase/firebaseui-web/issues/556
Thx !
I found a few problems with this issue:
To continue our conversation in firebase/firebaseui-web#556:
I tried it with Typescript and couldn't reproduce. I doubt the empty d.ts files added in 5.8.0 caused your issue, but I'm also not 100% sure. I will need to see all your dependencies and the webpack configuration.
The best way for us to debug it for you is to create a repro with minimal code. Can you please create one?
Hey @devsheder. We need more information to resolve this issue but there hasn't been an update in 7 days. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
@devsheder I'm not using TypeScript but a "firestore is not a function" error I encountered was fixed only after a full reinstall (rm -rf node_modules + rm package-lock.json + npm install).
Hi @Feiyang1
I tried @laurentpayot solution and it worked for me !
The answer was to remove package-lock.json file and run npm install.
Thanks for all you response.
I close the issue :)
Most helpful comment
Hi @Feiyang1
I tried @laurentpayot solution and it worked for me !
The answer was to remove
package-lock.jsonfile and runnpm install.Thanks for all you response.
I close the issue :)