dalenguyen / firebase-wordpress-plugin

A plugin that helps to integrate Firebase to WordPress
https://firebase-wordpress-docs.readthedocs.io
GNU General Public License v2.0
111 stars 31 forks source link

No Storage Bucket defined - V 1.7 #84

Closed hgalarreta closed 4 years ago

hgalarreta commented 4 years ago

Describe the bug Not sure if it's a bug, but I configured the Bucket Storage with: "my-app.appspot.com" and checked the Storage option as described in the instructions; but when using a simple code to update an image to firebase Storage, I get the "Uncaught Error: No Storage Bucket defined in Firebase Options.”

To reproduce the behavior: On an empty wordpress page, using html editor:

<input type="file" id="photo">
<img id="image">
<button onclick="uploadImage()">Upload Image</button>
  <script src="https://www.gstatic.com/firebasejs/7.7.0/firebase-storage.js"></script>
<script>
    console.log(firebase);
 function uploadImage() {
      var ref = firebase.storage().ref();
      const file = document.querySelector("#photo").files[0];
      const name = +new Date() + "-" + file.name;
      const metadata = {
        contentType: file.type
      };
      const task = ref.child(name).put(file, metadata);
      task
        .then(snapshot => snapshot.ref.getDownloadURL())
        .then(url => {
          console.log(url);
          document.querySelector("#image").src = url;
        })
        .catch(console.error);
    }
</script>

Desktop (please complete the following information):

Additional context This is the sample page: https://asisteme-peru.com/storage-test

Screenshots image image

dalenguyen commented 4 years ago

Hi @hgalarreta, the plugin already added storage script, so you don't have to append it yourself.

// this can be removed from your script.
<script src="https://www.gstatic.com/firebasejs/7.7.0/firebase-storage.js"></script>

image

firebase.storage() is available in the console log.

I saw a misconfigured in the firebase initialization. It will be fixed and released in a few hours. Thanks for your ticket.

dalenguyen commented 4 years ago

Cloud Storage is fixed. Please update the plugin to v1.8.0.

Docs: https://firebase-wordpress-docs.readthedocs.io/en/latest/storage/cloud-storage-integration.html

hgalarreta commented 4 years ago

Perfecto. works as a charm, thanks. Now the only thing missing is custom notifications, like to a specific token hehe