Get a warning after hot reloading my app w/ react-hot-loader and hot(App)
Extract of console output:
./src/firebase/index.js (loader)
import { initializeApp } from "firebase/app";
import firebaseConfig from "./config";
// load and apply firebase config
export default function initFirebaseApp(appName) {
let app = initializeApp(firebaseConfig, appName);
}
export { firebaseConfig };
./src/App.js (extract) (loader caller)`
import { hot } from "react-hot-loader/root";
import React from "react";
import debug from "debug";
import ...
import AppContext from "./AppContext";
class App extends React.Component {
constructor(props) {
super(props);
this.firebaseApp = initFirebaseApp(firebaseConfig.projectId);
this.logger = debug(firebaseConfig.projectId);
this.logger.log = console.log.bind(console);
this.state = {
...
};
}
componentWillUnmount() {
// TODO: look up app.database.ref(...).off()
firebase
.delete(this.firebaseApp)
.then(() => {
console.log("App deleted successfully");
})
.catch(error => {
console.log("Error deleting firebase app:", error);
});
}
render() {
return (
<div>
<AppContext.Provider
value={...}
>
<Header />
<main>
...
</main>
</AppContext.Provider>
</div>
);
}
}
export default hot(App);
I found a few problems with this issue:
Error is caused by this line. By using name as the app name in the template, we're also overwriting this field which should always be "FirebaseError".
Quick solution: Rename the field in the template to something like appName.
Best solution: Move template data under a new data field in FirebaseError.
So it's a firebase-based error/bug?
Yeah, sorry. :smile:
You can ignore that warning for now.
I also have this error in nuxt.js app. I call firebase.initializeApp(config); and everything is right, but the error happens.
Same error here - on nextjs
Same error here - on nuxt.js
with firebase 6.3.5, the problem disappeared
Most helpful comment
Yeah, sorry. :smile:
You can ignore that warning for now.