我是Firebase函數(shù)的新手-顯然-我正在嘗試測試是否在創(chuàng)建帳戶時正在使用數(shù)據(jù)庫創(chuàng)建時在該特定路徑中的電子郵件是否被某個帳戶使用,然后相應地更改該數(shù)據(jù)庫值。這是代碼:exports.checkEmail = functions.database.ref('/checkEmailExistance') .onCreate((snapshot, context) => { // Grab the current value of what was written to the Realtime Database. const email = snapshot.val(); console.log('Email:', email, context.params.pushId); admin.auth().getUserByEmail(email) .then(snapshot => { const data = snapshot.toJSON() return admin.database().ref('checkEmailExistance').child(email).set("Nope") })});錯誤是:ERROR: /Users/nathan/Documents/FirebaseFunctionsClipify/functions/src/index.ts:41:7 - Promises must be handled appropriatelyERROR: /Users/nathan/Documents/FirebaseFunctionsClipify/functions/src/index.ts:42:13 - Shadowed name: 'snapshot'npm ERR! code ELIFECYCLEnpm ERR! errno 2npm ERR! functions@ lint: `tslint --project tsconfig.json`npm ERR! Exit status 2npm ERR! npm ERR! Failed at the functions@ lint script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR! /Users/nathan/.npm/_logs/2019-04-25T16_21_29_696Z-debug.logError: functions predeploy error: Command terminated with non-zero exit code2更新:我更改了代碼,因此不應再次產生該錯誤,但仍然遇到相同的錯誤:exports.checkEmail = functions.database.ref('/checkEmailExistance') .onCreate((snapshot, context) => { // Grab the current value of what was written to the Realtime Database. const email = snapshot.val(); console.log('Email:', email, context.params.pushId); return admin.auth().getUserByEmail(email) .then(snap => { const data = snap.toJSON() return admin.database().ref('checkEmailExistance').child(email).set("Nope") }) });
為什么我不能將此代碼部署到Firebase函數(shù)?我不明白這個錯誤
qq_笑_17
2021-05-06 10:11:22