Skip to content

Firebase.init() throws error when JSON config has no databaseURL key #57

@phlummox

Description

@phlummox

Make sure these boxes are checked before submitting your issue:

[x] Check that your version of Python is 3.4+
[x] Check that you are on the newest version of Pyrebase
[x] Check that Email/password provider is enabled in your Firebase dashboard under Auth -> Sign In Method.

At least on my current Firebase project, the JSON configuration got from the Firebase console has no "databaseURL" key.

Instead, the keys are:

{
 "apiKey": ...,
 "authDomain": ...,
 "projectId": ...,
 "storageBucket": .,
 "messagingSenderId": ...,
 "appId": ...,
 "measurementId": ...
}

That means that the following line of pyrebase.Firebase.__init__ throws an exception:

self.database_url = config["databaseURL"]

The fix seems to be to replace that line with the following code

        if "databaseURL" in config:
          self.database_url = config["databaseURL"]

but I don't know if that has knock-on consequences elsewhere in the codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions