title: function returns undefined, should return promise or value
body: <p>I am getting value inside token variable but the code is producing error saying that function should return promise or value. the reason for which I would like to access token is to send notification to the receiver about the received request. my problematic code snippet is present below.</p>
  
  <pre><code>const functions = require('firebase-functions');
   var admin = require('firebase-admin');
   var promise=require('promise');
   admin.initializeApp();
  
   exports.sendRequestReceivedNotification=functions
          .database
          .ref('/Requests/{receiverID}/receivedFrom/{senderID}')
          .onCreate((snapshot,context)=&gt;{
              const receiverID= context.params.receiverID;
              const senderID=context.params.senderID;
              console.log(senderID,' sent message to ',receiverID);
  
  
              admin.database().ref()
                              .child('DeviceTokens')
                              .child(receiverID)
                              .child('deviceToken')
                              .once('value')
                              .then(function(snapshot){
                                  var token=snapshot.val();
                                  console.log(token);
                                  return true;
                              })
                              .catch(function(error){
                                  return false;
                              });
  
              });
  </code></pre>
  
  <p>while deploying, running and triggering the function i am getting the error as shown in the following snapshot. 
   I have googled abut promises, then().catch() structure but could not get the grasp and the illusion has been never clear to me... :(  </p>
  
  <p>return undeifned value:</p>
  
  <p><a href="https://i.stack.imgur.com/BSFEz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BSFEz.jpg" alt="enter image description here"></a></p>
  
  <p>Could someone be kind enough to explain the issue here and remedy to this problem please?</p>