Quickstart-unity: Firebase.Storage.StorageException: An unknown error occurred

Created on 16 Dec 2016  Â·  17Comments  Â·  Source: firebase/quickstart-unity

Hello,
I am getting this error when I tried to download a file from firebase storage.

Firebase.Storage.StorageException: An unknown error occurred, please check the HTTP result code and inner exception for server response. ---> System.IO.IOException: Could not open resulting stream.
  at Firebase.Storage.StreamDownloadTask.CreateDownloadStream () [0x00000] in <filename unknown>:0 
  at Firebase.Storage.StreamDownloadTask+Callable160.Call () [0x00000] in <filename unknown>:0 
  at Firebase.Storage.StreamDownloadTask+StreamProgressWrapper.CheckStream () [0x00000] in <filename unknown>:0 

The file was downloaded fine when it was under the root reference.
But this error happened when I put it under a sub folder.
I have also added the read/ write rule like this:

match /path {
allow read, write;
}

I am able to reproduce this error using the sample app. Can you help with this? Thanks.

bug

Most helpful comment

Hi Kobe, I've confirmed this is a bug. It is partly due to an issue with Firebase Storage and partly due to a bug in Unity3d.
The fix on the Firebase side is queued and you should see it in the next release. However, the behavior will not be fixed until Unity 5.6 which is currently in beta and fixes a bug in how http urls are handled.
Thanks for taking the time to report this.

All 17 comments

Hi Kobe,

The error indicates that there is a problem creating the output stream, which is the resulting file on disk. It actually is not related to the source of the data in Firebase Storage. Could it be that you are trying to create the file in a subfolder and maybe that subfolder does not exist -- or you do not have permissions to that subfolder?
Can you please indicate the destination path you are using and platform?

-Ben

Hi, Ben

I was trying in editor. Here is my path

storageRef.GetFileAsync(Application.persistentDataPath+'/'+"test.txt").ContinueWith(task ...

I didn't use a coroutine.

I also tried the code from sample app which directly load the file into the memory:

IEnumerator DownloadFromFirebaseStorage() { StorageReference reference = FirebaseStorage.DefaultInstance .GetReferenceFromUrl(firebaseStorageLocation); var task = reference.GetBytesAsync(1024 * 1024); yield return new WaitUntil(() => task.IsCompleted); if (task.IsFaulted) { DebugLog(task.Exception.ToString()); } else { fileContents = Encoding.UTF8.GetString(task.Result); DebugLog("Finished downloading..."); DebugLog("Contents=" + fileContents); } }

I got the same error too.

I only added the extra path in
if (firebaseStorageLocation == null) { firebaseStorageLocation = MyStorageBucket + "path/test.txt"; }

If I remove the path here it works for me.
Thanks.

Hi Kobe, I've confirmed this is a bug. It is partly due to an issue with Firebase Storage and partly due to a bug in Unity3d.
The fix on the Firebase side is queued and you should see it in the next release. However, the behavior will not be fixed until Unity 5.6 which is currently in beta and fixes a bug in how http urls are handled.
Thanks for taking the time to report this.

Cool. Thank you.

I'm facing the same issue did you guys fixed it?

The fix is queued on our side, but unity APIs also have a corresponding
issue that causes the issue to still manifest until 5.6. However, smiles@
is working on an unrelated fix that also affects this issue, so stay tuned.

On Tue, Jan 3, 2017 at 11:33 PM, umresh notifications@github.com wrote:

I'm facing the same issue did you guys fixed it?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/firebase/quickstart-unity/issues/28#issuecomment-270310398,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AH7cpbeiXhhn5meci92CUt2e68aJTaBUks5rO0tagaJpZM4LOxcE
.

Same here, for some additional info that might (maybe) help you. I am so far getting this on the Unity Editor as well as on an Android device. I am running Unity 5.6.0b3

The Android device is additionally displaying this:

01-09 13:19:05.528 11001 11054 D Unity : UnityWebRequest: reponseCodeCallback with code=400 url=https://firebasestorage.googleapis.com/v0/b/*.appspot.com/o/packages/*?alt=media

The full log being

01-09 13:19:04.740 11001 11054 D Unity : UnityWebRequest: created with method=GET; url=https://firebasestorage.googleapis.com/v0/b/*.appspot.com/o/packages/*?alt=media
01-09 13:19:04.740 11001 11054 D Unity : UnityWebRequest: run
01-09 13:19:04.741 11001 11054 D Unity : UnityWebRequest: headers={X-Firebase-Storage-Version=DotNet/1.0, X-Unity-Version=5.6.0b3, Authorization=Firebase TOKEN}
01-09 13:19:05.526 11001 11054 D Unity : UnityWebRequest: reponseCodeCallback with code=400 url=https://firebasestorage.googleapis.com/v0/b/*.appspot.com/o/packages/*?alt=media
01-09 13:19:05.527 11001 11054 D Unity : UnityWebRequest: headers set
01-09 13:19:05.528 11001 11054 D Unity : UnityWebRequest: contentLengthCallback with length=84
01-09 13:19:05.528 11001 11054 D Unity : UnityWebRequest: reponseCodeCallback with code=400 url=https://firebasestorage.googleapis.com/v0/b/*.appspot.com/o/packages/*?alt=media
01-09 13:19:05.529 11001 11054 D Unity : UnityWebRequest: downloaded
01-09 13:19:05.622 11001 11229 W Unity : gs://*.appspot.com/packages/* Exception occurred calling doInBackground.:System.IO.IOException: Could not open resulting stream.
01-09 13:19:05.622 11001 11229 W Unity : at Firebase.Storage.StreamDownloadTask.CreateDownloadStream () [0x00000] in :0
01-09 13:19:05.622 11001 11229 W Unity : at Firebase.Storage.StreamDownloadTask+Callable160.Call () [0x00000] in :0
01-09 13:19:05.622 11001 11229 W Unity : at Firebase.Storage.StreamDownloadTask+StreamProgressWrapper.CheckStream () [0x00000] in :0
01-09 13:19:05.622 11001 11229 W Unity : Stacktrace is not supported on this platform.
01-09 13:19:05.622 11001 11229 W Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
01-09 13:19:05.622 11001 11229 W Unity :
01-09 13:19:05.708 11001 11024 I Unity : System.AggregateException: Exception of type 'System.AggregateException' was thrown.
01-09 13:19:05.708 11001 11024 I Unity : -----------------
01-09 13:19:05.708 11001 11024 I Unity : Firebase.Storage.StorageException: An unknown error occurred, please check the HTTP result code and inner exception for server response. ---> System.IO.IOException: Could not open resulting stream.
01-09 13:19:05.708 11001 11024 I Unity : at Firebase.Storage.StreamDownloadTask.CreateDownloadStream () [0x00000] in :0
01-09 13:19:05.708 11001 11024 I Unity : at Firebase.Storage.StreamDownloadTask+Callable160.Call () [0x00000] in :0
01-09 13:19:05.708 11001 11024 I Unity : at Firebase.Storage.StreamDownloadTask+StreamProgressWrapper.CheckStream () [0x00000] in :0
01-09 13:19:05.708 11001 11024 I Unity : --- End of inner exception stack trace ---
01-09 13:19:05.708 11001 11024 I Unity :
01-09 13:19:05.708 11001 11024 I Unity : Stacktrace is not supported on this platform.
01-09 13:19:05.708 11001 11024 I Unity : (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
01-09 13:19:05.708 11001 11024 I Unity :

I believe we have fixed this issue in 1.1.1

https://firebase.google.com/support/release-notes/unity#1.1.1

Could folks confirm?

Does this fix requires Unity 5.6?
Thank you

No it should not require 5.6

On Thu, Jan 19, 2017 at 2:57 PM, kobechenyang notifications@github.com
wrote:

Does this fix requires Unity 5.6?
Thank you

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/firebase/quickstart-unity/issues/28#issuecomment-273925441,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AH7cpbzMwYEMP3vqzmOUt98qj5BnMh4pks5rT-pNgaJpZM4LOxcE
.

Hmm. I am getting this error after directly update both firebase database and firebase storage:

EntryPointNotFoundException: Firebase_App_CSharp_AppGetLogLevel
Firebase.AppUtil.AppGetLogLevel ()
Firebase.FirebaseApp+FirebaseHandler.LogMessage (LogLevel logLevel, System.String message)
Firebase.Internal.InstallRootCerts.InstallDefaultCRLs (System.String resource_name, System.String directory)
Firebase.Internal.InstallRootCerts.Process (Firebase.FirebaseApp app)
Firebase.FirebaseApp.CreateAndTrack (Firebase.CreateDelegate createDelegate)
Firebase.FirebaseApp.Create ()
Firebase.FirebaseApp.get_DefaultInstance ()

Should I delete all the plugins first and do fresh install ?

Try installing on one of the empty quickstarts to see if you still see that
error. From the error it looks like one of the native libraries wasnt
installed properly.

On Thu, Jan 19, 2017 at 3:54 PM, kobechenyang notifications@github.com
wrote:

Hmm. I am getting this error after directly update both firebase database
and firebase storage:

EntryPointNotFoundException: Firebase_App_CSharp_AppGetLogLevel
Firebase.AppUtil.AppGetLogLevel ()
Firebase.FirebaseApp+FirebaseHandler.LogMessage (LogLevel logLevel,
System.String message)
Firebase.Internal.InstallRootCerts.InstallDefaultCRLs (System.String
resource_name, System.String directory)
Firebase.Internal.InstallRootCerts.Process (Firebase.FirebaseApp app)
Firebase.FirebaseApp.CreateAndTrack (Firebase.CreateDelegate
createDelegate)
Firebase.FirebaseApp.Create ()
Firebase.FirebaseApp.get_DefaultInstance ()

Should I delete all the plugins first and do fresh install ?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/firebase/quickstart-unity/issues/28#issuecomment-273936483,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AH7cpXYMZvXyNJy43K5m7mhFHKEyjpK4ks5rT_fOgaJpZM4LOxcE
.

Hello,

This error
EntryPointNotFoundException: Firebase_App_CSharp_AppGetLogLevel

is gone after I restarted Unity.

And I can verify that the files are successfully download from firebase subfolder in Editor.
I haven't try on device yet.

Good job. Thank you guys.

capture

Try This Finally got it working !!

To clarify, @bilelmnasser you're seeing problems when using the 1.1.1 version of the SDK? We would love to root cause and fix this issue if you could describe the problem you're running into.

@stewartmiles i see this error with SDK v 1.1.1, and unity3d 5.5, the problem only occurs when i use Stripping Level.

We had some issues with the Storage API in 1.1.2 with various .NET SDK revisions and platforms due to the network stack implementation in Unity. We've moved everything over to WWW in 3.0.0 which should resolve your issues, see https://firebase.google.com/support/release-notes/unity#3.0.0 for the complete release notes.

Was this page helpful?
0 / 5 - 0 ratings