I want to create default values in firebase realtime database when someone login to my application. And i have deployed this code through vb code to cloud function to do this job.
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.defaultaccountparams = functions.auth.user().onCreate(user => {
const userObject = {
name : user.displayName,
email : user.email,
profile_picture : user.photoURL,
createdOn : user.metadata.creationTime || null,
matches_played : 0,
BC_won : 0,
total_kills : 0,
matches_won : 0,
BC: 0,
joined_matches : 0,
};
admin.database().ref('users/' + user.uid).set(userObject);
});
But this function is not creating values and in function log there is not any error about this function. Please help me to solve it.