functions-samples
functions-samples copied to clipboard
child-count sample has not been updated for v1.0
How to reproduce these conditions
Take the sample function from: https://github.com/firebase/functions-samples/blob/master/child-count/functions/index.js
And try to deploy it on the Cloud Functions for Firebase v1.0 SDK. You'll get this error:
TypeError: Cannot read property 'ref' of undefined at
It looks like it's OK. Can you double check you were indeed using the SDK v1 pls?
It looks like recountlikes
wasn't updated:
https://github.com/firebase/functions-samples/blob/master/child-count/functions/index.js#L47-L49
exports.recountlikes = functions.database.ref('/posts/{postid}/likes_count').onDelete((snap) => {
const counterRef = snap.ref;
const collectionRef = counterRef.parent.child('likes');
Experiencing the same. Looks like onCreate() and onDelete() is passing in an event instead of a DataSnapshot?
Any updates on this?