title: How to pass data between firebase cloud functions
body: <p>I'm trying to fetch the current user id from the app by making https requests to call functions from the client app. It's working and I'm fetching the uid. The problem is whenever the onWrite() function is triggered I need to send notifications to a specific user under a specific user id. How can I pass the uid that I got from my https functions to the trigger functions?</p>
  
  <p>I just retrieved the user id of the current user from the client app using an https.onCall().
  Then in the trigger function, I'm trying to send notifications to a specific user classified by uid using expo push notifications API.</p>
  
  <p>functions/index.js</p>
  
  <pre><code>const functions = require('firebase-functions');
  var fetch = require('node-fetch')
  
  const admin = require('firebase-admin')
  admin.initializeApp(functions.config().firebase)
  
  
  exports.getUid = functions.https.onCall((data, context) =&gt; {
      uid = data.text
      console.log(data.text)
  })
  
  exports.makerOrders = functions.database.ref('orders')
      .onWrite((snapShot, context) =&gt; {
          console.log('functions is triggered :)')
  
      return admin.database().ref('Notifications').child(uid)
          .once('value')
          .then((shot) =&gt; {
              var message = []
  
              var tokens = shot.val().expoTokens;
  
              if (tokens) {
                  message.push({
                      "to": tokens,
                      "body": "Notifications are working fine :)"
                  })
              }
              return Promise.all(message)
          }).then(message =&gt; {
              fetch('http://exp.host/--/api/v2/push/send', {
                  method: "POST",
                  headers: {
                      "Accept": "application/json",
                      "Content-Type": "application/json"
                  },
                  body: JSON.stringify(message)
              })
              return Promise.all(message)
          })
  })
  </code></pre>
  
  <p>App.js</p>
  
  <pre><code>var uid = firebase.auth().currentUser.uid
  var getUid = firebase.functions().httpsCallable('getUid')
  getUid({text: uid}).then(result =&gt; {
    var msg = result.data
    console.log(msg)
    console.log('Called successfully :)')
  }).catch(error =&gt; {
    console.log('Error :( in sending the requests')
  });
  </code></pre>
  
  <p>I'm expecting to fetch the uid value of the current user from the app so that I can send push notifications to that specific user.</p>
  
  <p>I can't able to retrieve the uid for the currently authed user.</p>