Firebase function to return download URL

I’m trying to return some data using a firebase function for security reasons, within said data is a firebase storage file location. I want to replace the location with the download URL so the front end can display the image. Here is a mock-up of my code

// The Cloud Functions for Firebase SDK to create Cloud Functions and set
// up triggers.
const functions = require("firebase-functions");

// The Firebase Admin SDK to access Firestore.
const firebase = require("firebase-admin");

firebase.initializeApp();


exports.getDetails = functions.https.onRequest(async (request, response) => {
    
    //...loads data 

    let details = [];
    await dataArray.forEach(async (doc) => {

        let data = doc.data();

        if(doc.data().type=="Photo Select" || doc.data().type=="Document Select"){

             try{
            url =  await firebase
            .storage()
            .ref()
            .child(doc.data().value)
            .getDownloadURL();
            } catch(e){
                console.log(e)
            }

            data["value"]=url? url : "";

         

        }  
        details.push(data)
    
    })
    response.json({ 
            details: details
        })
})

but in the error logs on running I’m getting
“TypeError: firebase.storage(…).ref is not a function”

Any help would be appreciated
😀