firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

Firebase storage timeout doesn't work

Open jarvislin opened this issue 1 year ago • 1 comments

[READ] Step 1: Are you in the right place?

Yes

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Android Studio Koala | 2024.1.1 Patch 2
  • Firebase Component: Storage
  • Component version: com.google.firebase:firebase-storage:21.0.0

[REQUIRED] Step 3: Describe the problem

I implemented a feature that allows users to select a photo from the gallery and upload it to Firebase Storage. However, if I switch my phone to airplane mode (no internet) before selecting the photo, my Logcat continuously outputs the following log:

2024-08-26 14:43:03.625   720-862   StorageUtil             com.jarvislin.producepricechecker    W  Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: No AppCheckProvider installed.
2024-08-26 14:43:04.837   720-862   ExponenentialBackoff    com.jarvislin.producepricechecker    W  network unavailable, sleeping.
2024-08-26 14:43:04.848   720-862   StorageUtil             com.jarvislin.producepricechecker    W  Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: No AppCheckProvider installed.
2024-08-26 14:43:06.070   720-862   ExponenentialBackoff    com.jarvislin.producepricechecker    W  network unavailable, sleeping.
2024-08-26 14:43:06.082   720-862   StorageUtil             com.jarvislin.producepricechecker    W  Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: No AppCheckProvider installed.
2024-08-26 14:43:07.230   720-862   ExponenentialBackoff    com.jarvislin.producepricechecker    W  network unavailable, sleeping.
2024-08-26 14:43:07.238   720-862   StorageUtil             com.jarvislin.producepricechecker    W  Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: No AppCheckProvider installed.
...

I expected the addOnFailureListener to be triggered instead.

Steps to reproduce:

  1. Turn off the internet.
  2. Select a photo and upload it.

Relevant Code:

Firebase.storage("my_url")
            .apply { maxUploadRetryTimeMillis = 10000 }
            .reference.child(path)
            .putBytes(bytes)
            .addOnSuccessListener {  }
            .addOnFailureListener { /* This is not triggered */ }
            .addOnCanceledListener {  }

jarvislin avatar Aug 26 '24 06:08 jarvislin

Hi @jarvislin, thank you for reaching out. I was able to reproduce the issue. The issue occurs only when using putBytes(). I tried using the putFile() and putStream and the maxUploadRetryTimeMillis is followed accordingly.

Per checking, the putBytes() is using the maxDownloadRetryTimeMillis while the other upload API's is using maxUploadRetryTimeMillis.

https://github.com/firebase/firebase-android-sdk/blob/cc3bb8e9daf2ac615e9d62e6144443337f4c009e/firebase-storage/src/main/java/com/google/firebase/storage/UploadTask.java#L107-L111

I'll inform our engineers about this and see what we can do here. Thanks!

lehcar09 avatar Aug 26 '24 15:08 lehcar09

Hey @jarvislin, we have released the fix for this issue on Cloud Storage for Firebase version 21.0.1.

With that, I’ll be closing this issue now. If the issue persists, please file a new issue thread. Thanks!

lehcar09 avatar Nov 27 '24 19:11 lehcar09