I'm new to web development and firebase and a error is appearing to me. I've not been able to solve it so came here to seek for help.
The error displayed is firebase.storage() is not a function. It seems that the firestorage is not set correctly in my computer. However, I've followed the instructions download from the google website itself and it did not change a thing.
I've seen some other questions regarding this on Stack Overflow, but they use node or react which is not my case. Can someone give me a hint?
I know it is not explained in details because, as I said before, I'm not an expert. Please be compreensive and I'll develop better my question.
The code I've created is bellow. The first block is a subset of an .html file. The other one is the body of my .js file
<!-- Firebase App is always required and must be first --> <script src=""></script> <!-- Add additional services that you want to use --> <script src=""></script> <script src=""></script> <script src=""></script> <script src=""></script> <script src=""></script> <!-- Inicializa o firebase --> <script> var config = { apiKey: "..", authDomain: "..", databaseURL: "..", projectId: "..", storageBucket: "..", messagingSenderId: "..", appId: ".." }; firebase.initializeApp(config); </script> <!-- Nosso app --> <script src="./app.js"></script>var fileInput = document.getElementById('file-input');
var stringInput = document.getElementById('string-input');
var ref = firebase.storage();
fileInput.onchange = function (event) {
}
stringInput.onchange = function (event) {
} 1 1 Answer
You need to include the firebase storage api.
You can do this by adding this line after you import the firebase-app script:
<script src=""></script>You can see a demo in this code sandbox: