Loading an image with getDownloadURL() from firebase storage do not work





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















It seems like getDownloadURL() is not working and gives an error.



I use nuxtjs and want to display an image on browser. The image was uploaded manually on firebase storage.



I tried



npm install xmlhttprequest


since the error was xmlhttprequest related.



but didn't change anything. I also think I really should install xmlhttprequest or not... because that seems something people do not use on nuxt or vue? I use firebase realtime db in other part and it is working fine using axios.



This is my code.



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


and I get this error on terminal.



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









share|improve this question































    1















    It seems like getDownloadURL() is not working and gives an error.



    I use nuxtjs and want to display an image on browser. The image was uploaded manually on firebase storage.



    I tried



    npm install xmlhttprequest


    since the error was xmlhttprequest related.



    but didn't change anything. I also think I really should install xmlhttprequest or not... because that seems something people do not use on nuxt or vue? I use firebase realtime db in other part and it is working fine using axios.



    This is my code.



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


    and I get this error on terminal.



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









    share|improve this question



























      1












      1








      1








      It seems like getDownloadURL() is not working and gives an error.



      I use nuxtjs and want to display an image on browser. The image was uploaded manually on firebase storage.



      I tried



      npm install xmlhttprequest


      since the error was xmlhttprequest related.



      but didn't change anything. I also think I really should install xmlhttprequest or not... because that seems something people do not use on nuxt or vue? I use firebase realtime db in other part and it is working fine using axios.



      This is my code.



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


      and I get this error on terminal.



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









      share|improve this question
















      It seems like getDownloadURL() is not working and gives an error.



      I use nuxtjs and want to display an image on browser. The image was uploaded manually on firebase storage.



      I tried



      npm install xmlhttprequest


      since the error was xmlhttprequest related.



      but didn't change anything. I also think I really should install xmlhttprequest or not... because that seems something people do not use on nuxt or vue? I use firebase realtime db in other part and it is working fine using axios.



      This is my code.



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


      and I get this error on terminal.



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






      javascript firebase vue.js firebase-storage nuxt.js






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 3 at 2:43









      Frank van Puffelen

      245k29389416




      245k29389416










      asked Jan 3 at 2:34









      cieux1cieux1

      122




      122
























          1 Answer
          1






          active

          oldest

          votes


















          0














          It looks like you're trying to use the Cloud Storage for Firebase client library on a server. It's only intended to work in a browser environment. Browsers provide a native XMLHttpRequest object, and that's what the client library is assuming. Installing the node module xmlhttprequest won't simply provide an implementation that will automatically import into the Firease SDK's own module.






          share|improve this answer
























          • Thanks, Doug! So my code above is not for server side...

            – cieux1
            Jan 3 at 11:10











          • I wonder why it is very hard to find a way to get an image path from firebase storage. That sounds like a basic thing to me. I am missing something obvious, maybe?

            – cieux1
            Jan 3 at 11:13












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54015608%2floading-an-image-with-getdownloadurl-from-firebase-storage-do-not-work%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          It looks like you're trying to use the Cloud Storage for Firebase client library on a server. It's only intended to work in a browser environment. Browsers provide a native XMLHttpRequest object, and that's what the client library is assuming. Installing the node module xmlhttprequest won't simply provide an implementation that will automatically import into the Firease SDK's own module.






          share|improve this answer
























          • Thanks, Doug! So my code above is not for server side...

            – cieux1
            Jan 3 at 11:10











          • I wonder why it is very hard to find a way to get an image path from firebase storage. That sounds like a basic thing to me. I am missing something obvious, maybe?

            – cieux1
            Jan 3 at 11:13
















          0














          It looks like you're trying to use the Cloud Storage for Firebase client library on a server. It's only intended to work in a browser environment. Browsers provide a native XMLHttpRequest object, and that's what the client library is assuming. Installing the node module xmlhttprequest won't simply provide an implementation that will automatically import into the Firease SDK's own module.






          share|improve this answer
























          • Thanks, Doug! So my code above is not for server side...

            – cieux1
            Jan 3 at 11:10











          • I wonder why it is very hard to find a way to get an image path from firebase storage. That sounds like a basic thing to me. I am missing something obvious, maybe?

            – cieux1
            Jan 3 at 11:13














          0












          0








          0







          It looks like you're trying to use the Cloud Storage for Firebase client library on a server. It's only intended to work in a browser environment. Browsers provide a native XMLHttpRequest object, and that's what the client library is assuming. Installing the node module xmlhttprequest won't simply provide an implementation that will automatically import into the Firease SDK's own module.






          share|improve this answer













          It looks like you're trying to use the Cloud Storage for Firebase client library on a server. It's only intended to work in a browser environment. Browsers provide a native XMLHttpRequest object, and that's what the client library is assuming. Installing the node module xmlhttprequest won't simply provide an implementation that will automatically import into the Firease SDK's own module.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 3:29









          Doug StevensonDoug Stevenson

          83.4k10100118




          83.4k10100118













          • Thanks, Doug! So my code above is not for server side...

            – cieux1
            Jan 3 at 11:10











          • I wonder why it is very hard to find a way to get an image path from firebase storage. That sounds like a basic thing to me. I am missing something obvious, maybe?

            – cieux1
            Jan 3 at 11:13



















          • Thanks, Doug! So my code above is not for server side...

            – cieux1
            Jan 3 at 11:10











          • I wonder why it is very hard to find a way to get an image path from firebase storage. That sounds like a basic thing to me. I am missing something obvious, maybe?

            – cieux1
            Jan 3 at 11:13

















          Thanks, Doug! So my code above is not for server side...

          – cieux1
          Jan 3 at 11:10





          Thanks, Doug! So my code above is not for server side...

          – cieux1
          Jan 3 at 11:10













          I wonder why it is very hard to find a way to get an image path from firebase storage. That sounds like a basic thing to me. I am missing something obvious, maybe?

          – cieux1
          Jan 3 at 11:13





          I wonder why it is very hard to find a way to get an image path from firebase storage. That sounds like a basic thing to me. I am missing something obvious, maybe?

          – cieux1
          Jan 3 at 11:13




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54015608%2floading-an-image-with-getdownloadurl-from-firebase-storage-do-not-work%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          'app-layout' is not a known element: how to share Component with different Modules

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          WPF add header to Image with URL pettitions [duplicate]