Each then() should return a value or throw Firebase cloud functions

后端 未结 3 904
青春惊慌失措
青春惊慌失措 2020-11-30 12:57

I am writing a cloud function for firebase using javascript but I am stuck, I don\'t know the exact meaning of error and unable to solve it.. The error states: 27:65 error

3条回答
  •  北海茫月
    2020-11-30 13:07

    Change this:

        return admin.messaging().sendToDevice(token_id, payload).then(response => {
    
        console.log('This was the notification Feature');
    
      });
    

    into this:

        return admin.messaging().sendToDevice(token_id, payload).then(response=>{
          console.log('This was the notification Feature');
          return true;
        },err=>
        {
          throw err;
        });
    

    As the error says when using then you need to return a value.

提交回复
热议问题