第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么我不能將此代碼部署到Firebase函數(shù)?我不明白這個錯誤

為什么我不能將此代碼部署到Firebase函數(shù)?我不明白這個錯誤

qq_笑_17 2021-05-06 10:11:22
我是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")       })    });
查看完整描述

1 回答

?
長風秋雁

TA貢獻1757條經驗 獲得超7個贊

第二個錯誤是告訴您您重新定義了一個稱為快照的現(xiàn)有變量。請注意,快照是在函數(shù)回調的頂層定義的,然后在then回調中再次定義。第二個實例是第一個實例的“陰影”,這是代碼中的潛在錯誤。只是將第二個變量命名為不同的名稱。


第一個皮棉錯誤是告訴您您的代碼中有未處理的承諾。您可以通過以下方式返回承諾來解決此問題admin.auth().getUserByEmail().then(...):


  return admin.auth().getUserByEmail(email)

  .then(snap => {

      const data = snap.toJSON()


      return admin.database().ref('checkEmailExistance').child(email).set("Nope") 

  })


查看完整回答
反對 回復 2021-05-13
  • 1 回答
  • 0 關注
  • 145 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號