Firebase Cloud Functions Database Trigger 'onCreate is not a function'

Viewed 3243

I want to use onCreate method instead of onWrite for the sake of efficiency but I face that error:

functions.database.ref(...).onCreate is not a function.

However, there seems to be a function as mentioned in the doc https://firebase.google.com/docs/reference/functions/functions.database.RefBuilder#onCreate
My code starts as follows:

const functions = require('firebase-functions');

const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);

exports.manager = functions.database.ref('some_ref')
    .onCreate(event =>{


I am looking forward to your helps.
Thanks in advance.

1 Answers
Related