Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
90 views
in Technique[技术] by (71.8m points)

python - Firebase get_app() issue

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...