Skip to content Skip to sidebar Skip to footer

Ondelete Not Being Called When Deleting A Node In Cloud Functions For Firebase

I am trying to build triggers for a firebase app around following and followers. Below is a snippet of my cloud code. I want to increase a counter when a user follows. For this

Solution 1:

onDelete isn't being called because you're listening to the entire followers node, so it would only be called when follower counts goes to zero (nothing left). Instead you probably want all of these to be more like:

functions.database.ref('/{pushId}/followers/{followerId}').onDelete()

It's also unusual that you have a top-level push id. A structure would normally be more like /users/{pushId}/followers/{followerId}.

Post a Comment for "Ondelete Not Being Called When Deleting A Node In Cloud Functions For Firebase"