Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

318
Views
Displaying image from Firebase to web using VueJS

I am new to Vue so I don't know many ways to do this. I want to display an image on my application which is stored in the Firebase storage. I am calling a function in the tag in the HTML part which returns the URL of the image. I am able to display the image in the console but it gives me a "Cannot find module" error when it is supposed to return the URL.

HTML

        <div>
            <p> Image gallery:</p>
            <img v-bind:src="getImgUrl()" >
        </div>

Vue Method

         async getImgUrl() {

            // Create a reference to the file we want to download
            const storage = getStorage();
            const stationsRef = ref(storage, 'stations/cal.jpg');

            // Get the download URL
            const imageurl = await getDownloadURL(stationsRef)
            .then((url) => {
                return (url);
            })
            console.log(imageurl)
            return require(imageurl);           
        },

and this is the error that it gives:

Uncaught (in promise) Error: Cannot find module 'https://firebasestorage.googleapis.com/v0/b/rideservices-6a23d.appspot.com/o/stations%2Fcal.jpg?alt=media&token=d020eef5-88f3-4f64-aab0-fcf00d67bcd5'
    at webpackEmptyContext (app.a802d1ae56e3977d.hot-update.js:40:10)
    at Proxy.getImgUrl (serviceRequest.vue?b4a4:168:1)

It would be really helpful if I can get help on this. Thanks in advance!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!