Firebase Functions Error: .once Is Not A Function
I am trying to deploy a simple function to Firebase, but I am having some difficulties. Every time I try to use .once on a reference Firebase tells me that it is not a function. He
Solution 1:
functions.database.ref
is a different object than the one you're used to using on the client. It's sole purpose is to listen for writes using it's only function, onWrite
.
You can obtain your intended ref thru the event
parameter.
var ref = event.data.ref
This is a reference to the path you specified in onWrite
.
If you want the root reference:
var rootRef = event.data.ref.root
Further reading: https://firebase.google.com/docs/reference/functions/functions.database
Post a Comment for "Firebase Functions Error: .once Is Not A Function"