I was trying to upload an image into my firebase storage but im getting the error
Cannot read properties of undefined (reading 'child')
This is my code below
const admin = require("firebase-admin");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://url.firebaseio.com",
storageBucket: "mybucket.appspot.com"
});
const dbStorage = admin.storage();
var uploadTask = dbStorage.bucket().ref('/news').child(key+"/"+image).put(image, metadata);//got an error
I was trying to fixed it like
dbStorage.bucket.child() //dbStorage.bucket.ref is not a function
dbStorage.bucket().child() //dbStorage.bucket(...).ref is not a function
dbStorage.ref('/news').child() //ref is not a fucntion