Forums

Pyrebase Uploads Small But Not Large mp3s

I'm using Pyrebase to upload mp3 files to Firebase. Here is the relevant code I use:

config = {
    "apiKey": "your_api_key",
    "authDomain": "your_project_id.firebaseapp.com",
    "databaseURL": "https://your_project_id.firebaseio.com",
    "projectId": "your_project_id",
    "storageBucket": "your_project_id.appspot.com",
    "messagingSenderId": "your_sender_id",
    "appId": "your_app_id"
}


firebase = pyrebase.initialize_app(config)
storage = firebase.storage()

try:
    storage.child("file.mp3").put('path")
    pubURL*emphasized text*=storage.child(newName).get_url(None)
    audTitle='/download?id='+newName
except Exception as e:
    return e

If I upload an mp3 of size 1.7MB I have no problem. If it's 22MB I get a 500 error message. Note the code I'm using comes from a program I run on my home computer that has no problem uploading the 22MB mp3 file. So this appears to be a problem with the server?

What is exactly the error you get?

Ok..I solved this by refreshing the token, using this code:

    user=auth.sign_in_with_email_and_password(email, password)
    user=firebase.auth().refresh(user['refreshToken'])
    storage.child("file.mp3").put("path", user['idToken'])

Glad to hear that you solved it!