Firebase Storage provides StorageException when trying to load images

I am trying to upload images to a new firebase storage service. It throws a StorageException

E / StorageException: A StorageException event has occurred. An unknown error has occurred, check the HTTP result code and the internal exception for the server response. Code: -13000 HttpResult: 400

E / StorageException: server terminated the download session java.io.IOException: server terminated the download session at com.google.firebase.storage.UploadTask.zzVi (Unknown source) at com.google.firebase.storage.UploadTask.zzVh (Unknown source) at com.google.firebase.storage.UploadTask.run (Unknown source) at com.google.firebase.storage.StorageTask $ 5.run (Unknown source) in java.util.concurrent.ThreadPoolExe cutor.runWorker (ThreadPoolExecutor.java:1113) in java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java//88) in java.lang.Thread.run (Thread.java:818)

+3
source share
10 answers

In google firebase, this type of StorageException usually caused by an incorrect StorageReference .

 FirebaseStorage storage = FirebaseStorage.getInstance(); StorageReference storageRef = storage.getReferenceFromUrl("gs://<your-bucket-name>"); // Create a reference to "file" StorageReference mountainsRef = storageRef.child("file.jpg"); 

Make sure the file link is correct.


Documentation Confirmation

Details on creating a repository link can be found here.

Details on storage exception codes can be found here for further references.

+4
source

I also got the same exception, but went through it just by granting storage permission to the application from:

Settings> Applications> {My application}> Permissions> Enable storage

The above part can also be done through Java code, I found out about this in the Android Marshmallow tutorial. Also, be sure to declare the permission for INTERNET and READ_EXTERNAL_STORAGE in the Android manifest file. However, if you still get an exception, try updating your playback services as well.

+2
source

In the Firebase console, go to the storage tab on the left. Go to the Rules tab and set a rule for everyone. Use the following code to set it up for sharing.

 service firebase.storage { match /b/{bucket}/o { match /{allPaths=**} { allow read, write; } } } 

This is good for testing purposes, however you must protect your database connection using user authentication.

+2
source

Today I faced the same problem.

+1
source

Enable anonymous authentication in the firebase console.

+1
source

Do not forget to add

 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

In your AndroidManifest.xml

+1
source

I ran into the same problem. I deleted the existing google.services.json file, downloaded it again from the Firebase console, and added it to my project. Now it works successfully.

+1
source

I ran into this problem when I did not create a link folder / bucket in the Firebase repository. Unlike the Firebase database, I think (I'm not sure yet) that the link to the repository will not create a bucket if it does not exist in the first place. So, first create a folder, and then try again.

0
source
  • Begin by checking to see if you have granted Internet permission in your manifest.

  • Check if you are allowed the correct authorization permission to write to the repository on the Rules tab of your repository.

  • Try Logging a link to Firebase Storage , as well as the File you are trying to download. Check to see if it works the same as the Firebase project you are running in a browser.

In my case, the configuration of the project was wrong, which is pretty much the first thing we do in the project. But hey! This is better than skipping on ";"

0
source

This parsed me , not a single line of code change;) All I had to do was update the firebase-storage library. In my case, it was 'com.google.firebase:firebase-storage:16.4.0' and after updating to 'com.google.firebase:firebase-storage:17.0.0' all over again 'com.google.firebase:firebase-storage:17.0.0' ok.

0
source

Source: https://habr.com/ru/post/1012749/


All Articles