//first call to initialize app
if (!firebase.apps.length) {
firebase.initializeApp(config)
}
When the user logs out, I need them to disconnect to the realtime database.
firebase.app().delete().then( () => {
if (!firebase.apps.length)
{
firebase.initializeApp(config)
}
this.goToSignin();
})
However, when I try to sign in again I get an error saying the default app is already deleted
FirebaseError: Firebase: Firebase App named '[DEFAULT]' already deleted (app/app-deleted).
I don't think you're supposed to ever re-initialize an app of the same name, even if the previous one is deleted. But I'm not entirely sure, so it might be worth to reach out to Firebase support for personalized help in troubleshooting.
In the meantime, I'd recommend generating named app instances, so that you can control their name.
const app = firebase.initializeApp(config, "myname");
You can then pass app
around and use that instead of firebase
in most places.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With