I have a firebase cloud function that triggers based on a new authentication that logs the user's information in the firebase real-time database. For some reason, the cloud function isn't triggering and the user is not getting registered in the database. This is the code for the cloud functions which I have tried to deploy
Index.js
const functions = require('firebase-functions')
const admin = require('firebase-admin')
admin.initializeApp(functions.config().firebase);
const ref = admin.database().ref()
exports.creatUserAccount = functions.auth.user().onCreate(event => {
const uid = event.data.uid
const displayName = event.data.displayName
const email = event.data.email
const photoURL = event.data.photoURL || 'https://yt3.ggpht.com/-Sz69_iENQd4/AAAAAAAAAAI/AAAAAAAAAAA/zLg-bS6DJFo/s900-c-k-no-mo-rj-c0xffffff/photo.jpg'
const phoneNumber = event.data.phoneNumber || ''
const batchList = ['']
const newUserRef = ref.child(`/users/students/${uid}`)
return newUserRef.set({
displayName: displayName,
email: email,
photoURL: photoURL,
uid: uid,
isDeleted: false,
phoneNumber: phoneNumber,
batchList: batchList,
})
})
exports.deleteUserAccount = functions.auth.user().onDelete(event => {
const uid = event.data.uid
const userRef = ref.child(`users/students/${uid}`)
return userRef.update({ isDeleted: true })
})
The firebase logs are empty and aren't helping me solve the problem