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

145
Views
I couldn't change this Firebase v8 code to v9

I want to change this below Firebase V8 code to Firebase V9 :

I tried many ways but it shows error

Please change this code to version 9

see full code : https://github.com/SimCoderYoutube/InstagramClone/blob/master/frontend/components/main/Save.js

import firebase from 'firebase/compat/app';
require("firebase/firestore")
require("firebase/firebase-storage")

const uploadImage = async () => {
        const uri = props.route.params.image;
        const childPath = `post/${firebase.auth().currentUser.uid}/${Math.random().toString(36)}`;
        console.log(childPath);

        const response = await fetch(uri);
        const blob = await response.blob();

        const task = firebase.storage()
        .ref()
        .child(childPath)
        .put(blob);

        const taskProgress = snapshot => {
            console.log(`transferred: ${snapshot.bytesTransferred}`)
        }

        const taskCompleted = () => {
            task.snapshot.ref.getDownloadURL().then((snapshot) => {
                savePostData(snapshot);
                console.log(snapshot)
            })
        }

        const taskError = snapshot => {
            console.log(snapshot)
        }

        task.on("state_changed", taskProgress, taskError, taskCompleted);
    }

Node modules are installed correctly. But it shows Error:

./node_modules/firebase/firebase-storage.js:1
Module not found: Can't resolve 'https://www.gstatic.com/firebasejs/9.5.0/firebase-app.js'
> 1 | import { getApp, _getProvider, _registerComponent, registerVersion, SDK_VERSION } from 'https://www.gstatic.com/firebasejs/9.5.0/firebase-app.js';
  2 |
  3 | /**
  4 |  * @license
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!