Unity Firebase Storage: GetDownloadUrlAsync() fails to retrieve url when using Unity with .Net 4.6

1,139 views
Skip to first unread message

kamarou.a...@gmail.com

unread,
Oct 16, 2017, 7:55:36 PM10/16/17
to Firebase Google Group
Looks like GetDownloadUrlAsync() fails to retrieve url when using Unity with .Net 4.6
It's just doesn't work and the task is stuck. I've tried it using several projects and 2 machines.
When switching back to .Net 3.5 it works as expected
Does anyone have a workaround for this? Is there any API request to get URL from storage reference?

Stewart Miles

unread,
Oct 16, 2017, 8:28:08 PM10/16/17
to Firebase Google Group
We're currently fixing an issue due to differences between Parse's emulation of System.Tasks library vs. the official .NET 4.6 implementation.  The problem we've run into is during initialization on main thread.  It's possible to workaround the problem by initializing Firebase on the main thread rather than in a Task.ContinueWith callback.

Any chance you have an error in your Unity log that you're missing?

Cheers,
Stewart

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/5123cc52-7179-48bf-8c61-68b6aecc4730%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

kamarou.a...@gmail.com

unread,
Oct 20, 2017, 10:18:18 AM10/20/17
to Firebase Google Group
I can't see any error on my side. I only can see that the TaskStatus is always "WaitingForActivation" in the debugger.
 Hope you'll resolve the issue  so we could use System.Threading.Tasks alongside with Firebase. It would be very nice to have stable Unity Firebase SDK  with .Net 4.6.


On Tuesday, October 17, 2017 at 3:28:08 AM UTC+3, Stewart Miles wrote:
We're currently fixing an issue due to differences between Parse's emulation of System.Tasks library vs. the official .NET 4.6 implementation.  The problem we've run into is during initialization on main thread.  It's possible to workaround the problem by initializing Firebase on the main thread rather than in a Task.ContinueWith callback.

Any chance you have an error in your Unity log that you're missing?

Cheers,
Stewart
On Mon, Oct 16, 2017 at 2:43 PM, <kamarou.a...@gmail.com> wrote:
Looks like GetDownloadUrlAsync() fails to retrieve url when using Unity with .Net 4.6
It's just doesn't work and the task is stuck. I've tried it using several projects and 2 machines.
When switching back to .Net 3.5 it works as expected
Does anyone have a workaround for this? Is there any API request to get URL from storage reference?

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

Thế Quyền Lê

unread,
Nov 11, 2017, 11:16:27 AM11/11/17
to Firebase Google Group
Hi guys,
I have the same problem with mr Kamarou that GetDownloadUrlAsync() fails to retrieve url when using Unity with .Net 4.6.
I also do the workaround that  initializing Firebase on the main thread rather than in a Task.ContinueWith callback, but It does not help.
In my case, there is a log like this:

https://firebasestorage.googleapis.com/v0/b/girlfriends-3e2f2.appspot.com/o/Android%2FAndroid Unable to reflect Uri field to fix slashes.  Storage operations will only work on the root path of your storage bucket
UnityEngine.Debug:Log(Object)
Firebase.FirebaseHandler:LogMessage(LogLevel, String)
Firebase.Unity.UnityLoggingService:LogMessage(LogLevel, String)
Firebase.Storage.Internal.Logger:<_platformLogger>m__0(LogLevel, Uri, String)
Firebase.Storage.Internal.Logger:I(Uri, String)
Firebase.Storage.Internal.Util:NewFixedUri(String)
Firebase.Storage.Network.NetworkRequest:CreateConnection()
Firebase.Storage.Network.NetworkRequest:PerformRequestStart(String)
Firebase.Storage.Network.NetworkRequest:PerformRequest(String)
Firebase.Storage.Internal.ExponentialBackoffSender:SendWithExponentialBackoff(NetworkRequest, Boolean)
Firebase.Storage.Internal.ExponentialBackoffSender:SendWithExponentialBackoff(NetworkRequest)
Firebase.Storage.GetMetadataTask:Run()
Google.Sharpen.ThreadPoolExecutor:RunPoolThread()
Google.Sharpen.RunnableAction:Run()
Google.Sharpen.Thread:InternalRun()
System.Threading.ThreadHelper:ThreadStart()

Do you have any idea how to get through that ? Or is there new version of Firebase storage unity SDK fix this problems ?
Any helps is appreciated.
Thank you
Le The Quyen

Vào 21:18:18 UTC+7 Thứ Sáu, ngày 20 tháng 10 năm 2017, kamarou.a...@gmail.com đã viết:

Anthony Maurice

unread,
Nov 15, 2017, 4:20:37 PM11/15/17
to fireba...@googlegroups.com
Hi,

We are still working on a fix for this, but I have had success with a workaround which may work for you.

Instead of GetDownloadUrlAsync(), you can get the Url via:

public Task<Uri> LocalDownloadUrlAsync() {
var task = storageReference.GetMetadataAsync();
return task.ContinueWith(t => {
  if (t.IsCompleted && !t.IsFaulted) {
    StorageMetadata metadata = task.Result;
    return metadata.DownloadUrl;
  }
});
}

This has worked for me locally, where GetDownloadUrlAsync has failed, so hopefully this can act as a workaround until a proper fix is released.

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

bry...@moback.com

unread,
Jan 8, 2018, 9:14:58 PM1/8/18
to Firebase Google Group
I'm bumping this thread because I'm running into this issue in what seems to be a place with no work-around. It's not with GetDownloadUrlAsync, it's with PutBytesAsync -

                var storageRef = storage.RootReference.Child(snapshotPath);
                var resultMetadata = await storageRef.PutBytesAsync(imageBytes, storageMetadata);

https://firebasestorage.googleapis.com/v0/b/XXXXX-XXXXX.appspot.com/o?name=images%2Fcapture-bfFW3chmg5e84v28snNkqXYvRA92-.jpg&uploadType=resumable Unable to reflect Uri field to fix slashes.  Storage operations will only work on the root path of your storage bucket
UnityEngine.Debug:Log(Object)
Firebase.Platform.FirebaseLogger:LogMessage(PlatformLogLevel, String)
Firebase.Unity.UnityLoggingService:LogMessage(PlatformLogLevel, String)
Firebase.Storage.Internal.Logger:<_platformLogger>m__0(LogLevel, Uri, String)
Firebase.Storage.Internal.Logger:I(Uri, String)
Firebase.Storage.Internal.Util:NewFixedUri(String)
Firebase.Storage.Network.NetworkRequest:CreateConnection()
Firebase.Storage.Network.NetworkRequest:PerformRequestStart(String)
Firebase.Storage.Network.NetworkRequest:PerformRequest(String)
Firebase.Storage.Internal.ExponentialBackoffSender:SendWithExponentialBackoff(NetworkRequest, Boolean)
Firebase.Storage.Internal.ExponentialBackoffSender:SendWithExponentialBackoff(NetworkRequest)
Firebase.Storage.UploadTask:SendWithRetry(NetworkRequest)
Firebase.Storage.UploadTask:BeginResumableUpload()
Firebase.Storage.UploadTask:Run()
Firebase.Storage.StorageTask`2:<GetRunnable>m__2()
Firebase.Storage.ActionRunnable:Run()
Google.Sharpen.ThreadPoolExecutor:RunPoolThread()
Google.Sharpen.RunnableAction:Run()
Google.Sharpen.Thread:InternalRun()
System.Threading.ThreadHelper:ThreadStart()

The proposed workarounds do not seem to address the issue, and since this is a critical path for our program and for Unity w/ .NET 4.6 use of FirebaseStorage generally, I think this bug should be promoted to Critical status!

We (as in people using Firebase with modern Unity) really need a fix for this issue for multiple reasons, so can we please get the bug at a higher priority? If we don't get a fix soon, we'll have to resort to using the REST Api instead, and that may be a non-trivial expense in terms of both time and money.

Cheers!

- Bryan

Vào 13:20:37 UTC-8 Thứ Tư, ngày 15 tháng 11 năm 2017, Anthony Maurice đã viết:

Anthony Maurice

unread,
Jan 9, 2018, 8:28:08 PM1/9/18
to Firebase Google Group
Hi Bryan,

I believe you might be experiencing a different problem.  The path reflection that we do is needed for when the path is of the form XX.appspot.com/o/images%2Fcapture-..., while yours instead has the bucket being passed as a parameter, with seemingly the correct formatting.

One thing that comes to mind is that a recent version of Unity had a problem with handling WWW requests.  I believe it was a version of 2017.2, but I'm not sure on the precise minor version.  I ran our testapp using the 2017.3.0f3 and .NET 4.6, and was able to write to non-root directories like you are trying to do (I also got the message about being unable to use reflection to modify the path).  What version of Unity are you seeing the problem with?

Alternatively, what error messages are you getting, if any?  It may be hanging, so it might be none.  Another thing you can do is set the log level to verbose, which gives a lot more logs, and may point out the problem:
Firebase.FirebaseApp.LogLevel = Firebase.LogLevel.Verbose;
storage.LogLevel = Firebase.LogLevel.Verbose;

Hopefully that helps!
-Anthony

bry...@moback.com

unread,
Jan 9, 2018, 8:50:51 PM1/9/18
to Firebase Google Group
Update - turns out I was able to workaround this because the issue didn't actually block the data from being uploaded.

Apologies!

Vào 18:14:58 UTC-8 Thứ Hai, ngày 08 tháng 1 năm 2018, bry...@moback.com đã viết:
Reply all
Reply to author
Forward
0 new messages