Skip to content

Firebase storage stops working after "Unable to create StorageReference" error #656

@shlighter

Description

@shlighter

Please fill in the following fields:

Unity editor version: 2019.3.6f1
Firebase Unity SDK version: 6.13.0
Source you installed the SDK (.unitypackage or Unity Package Manager):unitypackage
Firebase plugins in use (Auth, Database, etc.):Auth, Database, Storage
Additional SDKs you are using (Facebook, AdMob, etc.): none
Platform you are using the Unity editor on (Mac, Windows, or Linux): Windows
Platform you are targeting (iOS, Android, and/or desktop): Android (eventually)
Scripting Runtime (Mono, and/or IL2CPP):/

Please describe the issue here:

I noticed that if I apply a wrong URL to StorageReference, that gives me "Unable to create StorageReference" error, that's fine, but then I can't connect to the storage anymore, even if I type a correct StorageReference afterward (that gives no error), seems like I need to reset/clear the storage reference somehow.

Here is my code, if I remove the line with the arrow it works perfectly if I leave it as is the code is stuck at
GetBytesAsync and never continues, no catch, no fail.
What I tried- remove the await, using 2 different storageRefernces, resetting storage to DefaultInstance

My code is very basic-

    string wrongurl= "Not a good url"
    string goodurl ="gs://...."
    storage = FirebaseStorage.DefaultInstance;
    const long maxAllowedSize = 1 * 1024 * 1024;

     try{
    ===> storageRef =storage.GetReferenceFromUrl(wrongurl);}
    catch{}  //always caught because wrong url
   
    try{storageRef =storage.GetReferenceFromUrl(goodurl);}
    catch{}  //no catch because good

    try{
    var task2 = await storageRef.GetBytesAsync(maxAllowedSize).ContinueWith(t => t);

    if (task2.IsFaulted || task2.IsCanceled)
        {
              Debug.Log(task2.Exception.ToString());
            // Uh-oh, an error occurred!
        }
        else
        {}
    }
    catch{} // no catch

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? Yes

What's the issue repro rate? (eg 100%, 1/5 etc)
5
Fir

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-by-botneeds-infoNeed information for the developerstaleDon't have recent activity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions