I need to get download URL like this one for the image in my firebase storage:
in iOS, I can get the link using
import Firebase
Storage.storage().reference()child(path).downloadURL { (urlStorage, error) in
if let error = error {
print("there is an error while getting downloadURL String firebase storage: \(error.localizedDescription)")
completion(nil)
} else {
print("successfully get downloadURL String firebase storage firebase storage")
completion(urlStorage?.absoluteString)
}
}
but at this time I need to get the link in background trigger using cloud function. the code below will be triggered if an image uploaded to Firebase Storage
import * as admin from 'firebase-admin'
const defaultStorage = admin.storage()
admin.initializeApp()
export const updateUserProfileImagePathAfterUploadingImage = functions.storage.object().onFinalize(async (object) => {
// I don't know what to do in here. I can't access 'child' in 'defaultStorage' to access download URL like in the iOS code
})