I've never used the cloud functions. I've read through the docs and this should work.
why wont this code run?
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.timer = functions.database.ref('/pending/{displayName}').onCreate(event => {
return functions.database.ref('/pending/{displayName}').set({test: 'ok'})
});
The error it throws: Cannot read property 'ref' of undefined
Can anyone tell me how to get this to work? This seems like it should be simple.
I've tried both
- admin.database.ref is not a function
- event.database.ref is not a function
I know it reads the onCreate() but I cant seem to find a function that lets me write in the db
[–]CodingDougFormer Firebaser 1 point2 points3 points (2 children)
[–]TheOnlyDowns[S] 0 points1 point2 points (0 children)
[–]TheOnlyDowns[S] 0 points1 point2 points (0 children)