Failed to collect: No storage specified in Firebase Options. (The Internet)

I tried to upload a file (image) to firebase storage. but it throws an error saying "No data: no slave storage" error in Firebase options. This is my code

const fileUpBtn = document.getElementById('photoUpload');
const selectFile = document.getElementById('selectedFile');
const postIt = document.getElementById('postIt');

fileUpBtn.addEventListener('click',function(){
selectFile.click();
}
);
selectFile.addEventListener('change',function(e){

var file=e.target.files[0];
var filename = file.name;
console.log('/postPic/'+filename);
var storeLocation = storage.ref('/postPic/'+filename);
var uploadTask=storeLocation.put(file);  
});

      

I tried to allow storage for any users, but this situation fixes this error as well.

enter image description here

+3


source to share


1 answer


Probably the "storageBucket" option in the Firebase config is an empty string. Seems to be an empty string by default, unless "Storage" has been initialized on the console interface.

Go to the firebase console, initialize "Storage" by accessing it in the Firebase console interface, and then copy the new value for "storageBucket" from the firebase configuration into your application.



Your firebase config should look something like this.

{
  apiKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  authDomain: "my-app-a123z.firebaseapp.com",
  databaseURL: "https://my-app-a123z.firebaseio.com",
  projectId: "my-app-a123z",
  storageBucket: "my-app-a123z.appspot.com",
  messagingSenderId: "123456789012"
};

      

+13


source







All Articles