title: Firebase functions.https.onCall returns null
body: <p>I have the following firebase cloud function written in node.js that I call from my Android app.The function works fine but I get null when trying to get results in Android. I need return to my android app <code>console.log(result.data);</code> line, but that line called after firebase function completely done, so my Android app gets null.</p>
  
  <p><em>index.js</em></p>
  
  <pre><code>'use strict'
  
  const functions = require('firebase-functions');
  const admin = require('firebase-admin');
  const subcheck = require('./subcheck');
  admin.initializeApp();
  
  
  exports.subcheck = functions.https.onCall((data, context) =&gt; {
      subcheck.verifySubscription(data, context);
  });
  </code></pre>
  
  <p><em>And this is my subcheck.js</em></p>
  
  <pre><code>'use strict'
  const functions = require('firebase-functions');
  const admin = require('firebase-admin');
  const key =  require('./service-account-key.json'); // JSON key file
  const {google} = require('googleapis');
  
  const authClient = new google.auth.JWT({
      email: key.client_email,
      key: key.private_key,
      scopes: ["https://www.googleapis.com/auth/androidpublisher"]
  });
  
  const playDeveloperApiClient = google.androidpublisher({
      version: 'v3',
      auth: authClient
  });
  
  //admin.initializeApp(functions.config().firebase);
  
  exports.verifySubscription = function(data, context) {
      const skuId = data.sku_id;
      const purchaseToken = data.purchase_token;
      const packageName = data.package_name;
  
      return authClient.authorize()
          .then(function(result) {
              return playDeveloperApiClient.purchases.subscriptions.get({
                  packageName: packageName,
                  subscriptionId: skuId,
                  token: purchaseToken
              }).then(function(result) {
                  if (result.status === 200) {
                      console.log(result.data);
                      return {
                          data: result.data,
                          status: 200,
                          message: "Verified Subscription"
                      };
                  } else {
                      console.log("Failed to verify subscription, Try again!");
                      return {
                          data: result.data,
                          status: 500,
                          message: "Failed to verify subscription, Try again!"
                      };
                  }
              })
              .catch(function(error) {
                  console.log(error);
              });
  
          })
          .catch(function(error) {
              console.log(error);
          });
  
  }
  </code></pre>
  
  <p>This is my firebase functions console log: </p>
  
  <p><a href="https://i.stack.imgur.com/jNcit.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jNcit.png" alt="enter image description here"></a></p>
  
  <p>I'm trying to get results in Android with the following method :</p>
  
  <pre><code>    private Task&lt;String&gt; checkUserSubscribed(PurchaseHistoryRecord purchase) {
      Map&lt;String, Object&gt; mapUserPurchase = new HashMap&lt;&gt;();
      mapUserPurchase.put("sku_id", purchase.getSku());
      mapUserPurchase.put("purchase_token", purchase.getPurchaseToken());
      mapUserPurchase.put("package_name", "xxxxxxx");
  
      return mFirebaseFunctions
              .getHttpsCallable("subcheck")
              .call(mapUserPurchase)
              .continueWith(new Continuation&lt;HttpsCallableResult, String&gt;() {
                  @Override
                  public String then(@NonNull Task&lt;HttpsCallableResult&gt; task) throws Exception {
                      String result = (String) task.getResult().getData();
                      return result;
                  }
              }).addOnCompleteListener(new OnCompleteListener&lt;String&gt;() {
                  @Override
                  public void onComplete(@NonNull Task&lt;String&gt; task) {
                      String result = task.getResult();
                      Toast.makeText(MainActivity.this, "func results: " + result, Toast.LENGTH_SHORT).show();
                  }
              });
  }
  </code></pre>