Skip to content Skip to sidebar Skip to footer

Firebase Function Onwrite Not Being Called

I'm trying to implement a trigger using Firebase Functions, that duplicates some data in the database. I want to watch all additions at votes/user/vote, the structure is: And the

Solution 1:

Right now, the function is triggered by a write to

exports.duplicateFeedback = functions.database.ref('/votes/{userId}/voteId')

which would be triggered by something like this:

votes: {
    00000_josemi_foo: {
        voteId: {
            // data
        }
    }
}

But you're not looking for the child voteId, you're looking for any child of {userId}, such as -33, so you need to use a wildcard:

exports.duplicateFeedback = functions.database.ref('/votes/{userId}/{voteId}')

Post a Comment for "Firebase Function Onwrite Not Being Called"