Skip to content

Firebase Storage ref.delete() is emitting exception #5836

Open
@russellwheatley

Description

@russellwheatley

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

Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 2022.3.1
  • Firebase Component: Storage (Database, Firestore, Storage, Functions, etc)
  • Component version: 20.3.0

[REQUIRED] Step 3: Describe the problem

If you try to delete a reference that does not exist, an exception is still emitted even when using addOnCompleteListener or addOnFailureListener listener .

The logs might be intended but it's not something I've seen often in other API failures on firebase android.

Logcat logs
2024-04-05 08:15:35.822 14354-17160 StorageException        io....lugins.firebasestorageexample  E  StorageException has occurred.
                                                                                                    Object does not exist at location.
                                                                                                     Code: -13010 HttpResult: 404
2024-04-05 08:15:35.826 14354-17160 StorageException        io....lugins.firebasestorageexample  E  {  "error": {    "code": 404,    "message": "Not Found."  }}
                                                                                                    java.io.IOException: {  "error": {    "code": 404,    "message": "Not Found."  }}
                                                                                                    	at com.google.firebase.storage.network.NetworkRequest.parseResponse(NetworkRequest.java:415)
                                                                                                    	at com.google.firebase.storage.network.NetworkRequest.parseErrorResponse(NetworkRequest.java:432)
                                                                                                    	at com.google.firebase.storage.network.NetworkRequest.processResponseStream(NetworkRequest.java:423)
                                                                                                    	at com.google.firebase.storage.network.NetworkRequest.performRequest(NetworkRequest.java:265)
                                                                                                    	at com.google.firebase.storage.network.NetworkRequest.performRequest(NetworkRequest.java:282)
                                                                                                    	at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(ExponentialBackoffSender.java:76)
                                                                                                    	at com.google.firebase.storage.internal.ExponentialBackoffSender.sendWithExponentialBackoff(ExponentialBackoffSender.java:68)
                                                                                                    	at com.google.firebase.storage.DeleteStorageTask.run(DeleteStorageTask.java:59)
                                                                                                    	at com.google.firebase.concurrent.LimitedConcurrencyExecutor.lambda$decorate$0$com-google-firebase-concurrent-LimitedConcurrencyExecutor(LimitedConcurrencyExecutor.java:65)
                                                                                                    	at com.google.firebase.concurrent.LimitedConcurrencyExecutor$$ExternalSyntheticLambda0.run(Unknown Source:4)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
                                                                                                    	at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47)
                                                                                                    	at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(Unknown Source:4)
                                                                                                    	at java.lang.Thread.run(Thread.java:919)

Steps to reproduce:

  1. Run the code below
  2. See above noted logs in logcat.

Relevant Code:

Java snippet:

FirebaseStorage.getInstance().getReference().child("non-existent-ref.png")
        .delete()
        .addOnCompleteListener(
          task -> {
            if (task.isSuccessful()) {
              Log.d("tag", "referenceDelete: success");
            } else {
              Log.d("tag", "referenceDelete: failed");
            }
          }).addOnFailureListener(e -> {
          Log.d("tag", "referenceDelete: addOnFailureListener" + e);
        });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions