0

I really need help and am not sure why my code is not executing. I tried everything by reading different solution and there was no answer. so, I created a project with Firebase. As usual, i set up a config, and then initialized my firebase, and initialized my auth. After that, i wrote another line to create user_Credentials email with password. For some reason my python is not executing and I really dunno why.

Here is my code

 # Initializing firebase 
fireBase = pyrebase.initialize_app(firebaseConfig)
authen = fireBase.auth()

# testing 
email = "testing@gmail.com"
password = "123456"

authen.create_user_with_email_and_password(email, password)

Error message

Traceback (most recent call last):
  File "/Users/kin/Desktop/GitHubRepo/project/client/src/sign_up/authentication.py", line 15, in <module>
    fireBase = pyrebase.initialize_app(firebaseConfig)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyrebase/pyrebase.py", line 28, in initialize_app
    return Firebase(config)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyrebase/pyrebase.py", line 36, in __init__
    self.database_url = config["databaseURL"]
KeyError: 'databaseURL'

enter image description here

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Chung Lee
  • 13
  • 6

2 Answers2

0

You probably have not defined a value for "databaseURL" in your firebaseConfig.

pazitos10
  • 1,641
  • 16
  • 25
0

It looks like Pyrebase still requires this key to exist though, which is why you get an error.

You can do this two things for now....

1 - Just add a key with no value, or a dummy value


API_KEY = {
    'apiKey': "##############################",
    'authDomain': "********************",
    'projectId': "&&&&&&&&&&&",
    'storageBucket': "************",
    'messagingSenderId': "*************",
    'appId': "***************",
    'measurementId': "************",
    'databaseURL': ""
}

2 - Add the databaseURL from Your firebase account from here

API_KEY = {
        'apiKey': "##############################",
        'authDomain': "********************",
        'projectId': "&&&&&&&&&&&",
        'storageBucket': "************",
        'messagingSenderId': "*************",
        'appId': "***************",
        'measurementId': "************",
        'databaseURL': "link of your databaseURL"
}

well there was an issue already open at Pyrebase which target to this problem, fell free to solve this issue.