This is my code
const functions = require('firebase-functions');
exports.doSomething = functions.auth.user().onCreate(function(user) {
const userJsonString = JSON.stringify(user.toJSON);
// doing some network stuff in here the important part is I need a properly working user Object (needs a toJSON function)
});
But how can I trigger the onCreate() function? I already read about using the firebase cli by using the following command firebase functions:shell
but when I just trigger the function like this (as mentioned here):
doSomething({uid : "akdfkaf", username : "This is a username"})
It throws an error since toJSON
isn't defined on this object.
I also read this on the firebase docs but how do I achieve "following the data format"? Does this mean I have to implement my own classes and implement every function on my own (and probably guess the implementation of things like toJSON()
functions)?
As you probably realised I'm completely new to javascript and only need it for the cloud functions since this part only works with javascript.