As far as I know, it is not possible to remove firebase storage files from cloud functions. You can listen for change events in the clothing store, but you cannot interact with it.
What I was able to do was remove the βmessageβ from the database using .set (null). This returns a promise that, when resolved, you can use to invoke deletion in the firebase repository.
firebase.database().ref('Posts/{pushId}').set(null).then(() => { console.log('Post deleted from database') firebase.storage().ref(`Posts/${pushId}thumbnail-image.jpg`).delete().then(() => { console.log('Successfully deleted thumbnail'); }).catch(err => { console.log(err); }); }).catch(err => { console.log(err); });
Firebase storage will not allow you to delete the entire array recursively, so you need to delete every file every time.
Forbes gray
source share