I want to integrate the new Cloud Firestore into my cloud features.
I updated node.js and installed the latest firebase on my mac.
The documentation says:
exports.myFunctionName = functions.firestore .document('users/marie').onWrite((event) => { // ... Your code here });
must work. I simply copied the code and entered it in index.js, like all other real-time database functions. When I deploy the function code ($ firebase deploy --only functions), I get this error:
Cannot read property 'document' of undefined at Object.<anonymous> (/private/var/folders/zm/wp2415l929s472jv7kzbt3km0000gn/T/fbfn_21520Y4xqAJosBNHe/index.js:196:45) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12)
Any suggestions / ideas on the issue?
source share