The default Firebase app does not exist. Make sure to initialize ' ValueError: The default Firebase app does not exist. Make sure to initialize the SDK by calling initialize_app()
I have been getting this Value Error for my app project and couldn't find a way around. The app seemed to be working just fine and the error seemed to have popped out of nowhere.
I have looked into the Firebase admin sdk and figured the block of code where my app crashes:
def get_app(name=_DEFAULT_APP_NAME):
"""Retrieves an App instance by name.
Args:
name: Name of the App instance to retrieve (optional).
Returns:
App: An App instance with the given name.
Raises:
ValueError: If the specified name is not a string, or if the specified
app does not exist.
"""
if not isinstance(name, str):
raise ValueError('Illegal app name argument type: "{}". App name '
'must be a string.'.format(type(name)))
with _apps_lock:
if name in _apps:
return _apps[name]
if name == _DEFAULT_APP_NAME:
raise ValueError(
'The default Firebase app does not exist. Make sure to initialize '
'the SDK by calling initialize_app().')
raise ValueError(
('Firebase app named "{0}" does not exist. Make sure to initialize '
'the SDK by calling initialize_app() with your app name as the '
'second argument.').format(name))
The part:
if name == _DEFAULT_APP_NAME:
raise ValueError(
'The default Firebase app does not exist. Make sure to initialize '
'the SDK by calling initialize_app().')
is where my app crashes.
Any fix around this ?
question from:https://stackoverflow.com/questions/65624254/firebase-get-app-issue