Loading image with getDownloadURL() from Firebase Storage doesn't work


sky 1

It seems that getDownloadURL() is not working and giving error.

I use nuxtjs and want to display an image on the browser. The image has been manually uploaded on Firebase Storage.

I tried

npm install xmlhttprequest

Since the error is related to xmlhttprequest.

But nothing changed. I also think I should really install xmlhttprequest or not...as that seems to be something people don't use on nuxt or vue? I'm using firebase realtime database in other parts and it works fine with axios.

Here is my code.

var storageRef = firebase.storage.ref("/animals/cat.png");
storageRef.getDownloadURL().then(function(url) {
  console.log(url); 
});

I am getting this error on terminal.

node_modules/@firebase/storage/dist/index.cjs.js:672
        this.xhr_ = new XMLHttpRequest();
                    ^
ReferenceError: XMLHttpRequest is not defined
Doug Stevenson

It looks like you are trying to use the Cloud Storage for Firebase client library on the server. It only works in the browser environment. The browser provides a native XMLHttpRequest object, and this is what the client library assumes. Installing the node module xmlhttprequest does not simply provide an implementation that will be automatically imported into the Firease SDK's own module.

Related


How to get URL getDownloadURL from Firebase Storage

Jonathan Fager: I'm trying to get "Long Persistent Download Links" for a file in a Firebase bucket. I have changed its permissions to service firebase.storage { match /b/project-xxx.appspot.com/o { match /{allPaths=**} { allow read, write; }

Firebase storage image cache doesn't work

Shunta There are two image uris, the first is located in firebase storage and the second is a sample image from react-native blog . And I believe recat-native's Imagecomponents are cacheable. <View> <Image style={{ width: 100, height: 100 }}

Downloading files from Firebase Storage doesn't work

stable_progress In my Angular app, I am trying to retrieve a file saved on Firebase storage. For this, I wrote the following code: var storage = firebase.storage(); var fileRef = storage.ref(`${this.idOfCurrentUser}/personalData.card`); var blob =

taskSnapshot.getDownloadUrl() method doesn't work

David G private void uploadImageToFirebaseStorage() { StorageReference profileImageRef = FirebaseStorage.getInstance().getReference("profilepics/" + System.currentTimeMillis() + ".jpg"); if (uriProfileImage != null) { progressBar.setVi

Emgu CV image loading doesn't work

Nicole Martin I am using emgu cv version 3. I try to load an image to process. but this gives me errors. According to the error, it will say that the image cannot be read. But I have a picture under that location. Here is my line of code. Image<Bgr, Byte> imag

jQuery image loading doesn't work in Safari

Venillo The following code is used to set the properties of the img and then do something when the img is loaded. This works fine in Chrome and FireFox, but the let img..etc line is never attacked in Safari. why is it like this? $("<img/>").attr("src", "data:i

getDownloadUrl() doesn't work, "HTTP unknown error"

AL I have a problem with my code, I try to download an image from Firebase Storage. I am trying to put an image in an ImageView. @Override public void onBindViewHolder(@NonNull final PostViewHolder postViewHolder, int i) { Resources resources = Ho

Multiple image loading animation doesn't work

Ivan Taccadoli I have two images on my html page and I'm using jquery to check if they are fully loaded before removing the circle loader overlay (each image separately). So at the beginning, an overlay with a loader animation is displayed on each image, and e

Firebase storage image cache doesn't work

Shunta There are two image uris, the first is located in firebase storage and the second is a sample image from react-native blog . And I believe recat-native's Imagecomponents are cacheable. <View> <Image style={{ width: 100, height: 100 }}

Simple image upload from Unity to Firebase doesn't work

Lucas von Niederhauser I'm working on an IOS app I created with Unity in C# (Unity 2018.2.5f1). Now I try to upload the image to Firebase Storage to get familiar with it. Unfortunately this doesn't work. I think there is something wrong with the path to the lo

Firebase storage image cache doesn't work

Shunta There are two image uris, the first is located in firebase storage and the second is a sample image from react-native blog . And I believe recat-native's Imagecomponents are cacheable. <View> <Image style={{ width: 100, height: 100 }}

How to get URL getDownloadURL from Firebase Storage

Jonathan Fager I'm trying to get "Long Persistent Download Links" for a file in a Firebase bucket. I have changed its permissions to service firebase.storage { match /b/project-xxx.appspot.com/o { match /{allPaths=**} { allow read, write; } }

taskSnapshot.getDownloadUrl() method doesn't work

David G private void uploadImageToFirebaseStorage() { StorageReference profileImageRef = FirebaseStorage.getInstance().getReference("profilepics/" + System.currentTimeMillis() + ".jpg"); if (uriProfileImage != null) { progressBar.setVi

Loading image dynamically from JSON file doesn't work

André Gasser The Unity project I'm building targets iOS, Android and Windows X64. The problem In one of my scenarios, I use JSON files to dynamically load some sprites located in the Resources folder at runtime. The problem I'm currently having is: when I run

Downloading files from Firebase Storage doesn't work

stable_progress In my Angular app, I am trying to retrieve a file saved on Firebase storage. For this, I wrote the following code: var storage = firebase.storage(); var fileRef = storage.ref(`${this.idOfCurrentUser}/personalData.card`); var blob =

getDownloadUrl() doesn't work, "HTTP unknown error"

AL I have a problem with my code, I try to download an image from Firebase Storage. I am trying to put an image in an ImageView. @Override public void onBindViewHolder(@NonNull final PostViewHolder postViewHolder, int i) { Resources resources = Ho

Loading image from url doesn't work

bhavdip I have this link https://www.dropbox.com/s/ri4xbjaz64kezsg/30.jpg in my code ...but i can't download image from that link.. if i use other link, this link is i am able to download . so what's wrong with this link...please help me public class AndroidLo

Loading image into JLabel doesn't work

UNCTAD I try to use display image JLabel. Here is my project navigator: From SettingsDialog.javaI want to display the image using the following code: String path = "/images/sidebar-icon-48.png"; File file = new File(path); Image image;

Why Glide doesn't work with Firebase Storage

Christiana Gray I'm trying to load an image from Firebase Storage but I'm getting an exception when using Glide my code storageReference=FirebaseStorage.getInstance().getReference().child("profiles/"+firebaseUser.getUid()+"/"+"profilePic"); Glide.w

How to get URL getDownloadURL from Firebase Storage

Jonathan Fager: I'm trying to get "Long Persistent Download Links" for a file in a Firebase bucket. I have changed its permissions to service firebase.storage { match /b/project-xxx.appspot.com/o { match /{allPaths=**} { allow read, write; }

Emgu CV image loading doesn't work

Nicole Martin I am using emgu cv version 3. I try to load an image to process. but this gives me errors. According to the error, it will say that the image cannot be read. But I have a picture under that location. Here is my line of code. Image<Bgr, Byte> imag

Firebase storage image cache doesn't work

Shunta There are two image uris, the first is located in firebase storage and the second is a sample image from react-native blog . And I believe recat-native's Imagecomponents are cacheable. <View> <Image style={{ width: 100, height: 100 }}

Downloading files from Firebase Storage doesn't work

stable_progress In my Angular app, I am trying to retrieve a file saved on Firebase storage. For this, I wrote the following code: var storage = firebase.storage(); var fileRef = storage.ref(`${this.idOfCurrentUser}/personalData.card`); var blob =

taskSnapshot.getDownloadUrl() method doesn't work

David G private void uploadImageToFirebaseStorage() { StorageReference profileImageRef = FirebaseStorage.getInstance().getReference("profilepics/" + System.currentTimeMillis() + ".jpg"); if (uriProfileImage != null) { progressBar.setVi

Firebase storage image cache doesn't work

Shunta There are two image uris, the first is located in firebase storage and the second is a sample image from react-native blog . And I believe recat-native's Imagecomponents are cacheable. <View> <Image style={{ width: 100, height: 100 }}

Simple image upload from Unity to Firebase doesn't work

Lucas von Niederhauser I'm working on an IOS app I created with Unity in C# (Unity 2018.2.5f1). Now I try to upload the image to Firebase Storage to get familiar with it. Unfortunately this doesn't work. I think there is something wrong with the path to the lo

Loading image dynamically from JSON file doesn't work

André Gasser The Unity project I'm building targets iOS, Android and Windows X64. The problem In one of my scenarios, I use JSON files to dynamically load some sprites located in the Resources folder at runtime. The problem I'm currently having is: when I run