Whenever i'm running "firebase deploy --only functions" it hits up with this error Error occurred while parsing your function triggers.
TypeError: functions.https.onCall(...).then is not a function at Object. (C:\Users\Lenovo\Desktop\Firebase Revision\functions\index.js:11:4) at Module._compile (internal/modules/cjs/loader.js:1158:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10) at Module.load (internal/modules/cjs/loader.js:1002:32) at Function.Module._load (internal/modules/cjs/loader.js:901:14) at Module.require (internal/modules/cjs/loader.js:1044:19) at require (internal/modules/cjs/helpers.js:77:18) at C:\Users\Lenovo\AppData\Roaming\npm\node_modules\firebase-tools\lib\triggerParser.js:15:15 at Object. (C:\Users\Lenovo\AppData\Roaming\npm\node_modules\firebase-tools\lib\triggerParser.js:53:3) at Module._compile (internal/modules/cjs/loader.js:1158:30)
Following is my code in index.js functions
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.addAdminRole = functions.https.onCall((data,context) => {
return admin.auth().getUserByEmail(data.email).then(user => {
return admin.auth().setCustomUserClaims(user.uid,{
admin: true
});
})
}).then(()=>{
return {
message: `Success! ${data.email} has been made an admin`
}
}).catch(err => {
return err;
})