title: Firebase Function call returns "NOT_FOUND" exception. (Android, koltin)
body: <p>I am trying to use Firebase Functions in my koltin Android app to send a message from a client device to another.</p>
  <h1>Firebase Function within index.js</h1>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> exports.callUser = functions.https.onCall((data) =&gt; {
     console.log('Call request received.');
     // Message text passed from the client.
     const registrationToken = data.registrationToken;
     functions.logger.log('Calling', registrationToken);
     var message = {
       data: {
         doctor: 'foo',
         patient: 'bar',
         room: 'foobar'
       },
       token: registrationToken
     };
     return admin.messaging().send(message)
         .then((response) =&gt; {
             console.log('Successfully sent incoming call message:', response);
             return "Sent";
         })
         .catch((error) =&gt; {
             console.log('Error sending message:', error);
             throw new functions.https.HttpsError('unknown', error.message, error);
         });
   });</code></pre>
  </div>
  </div>
  </p>
  <h1>Firebase function client call</h1>
  <pre><code>private fun makeCall(registrationToken: String): Task&lt;String&gt; {
      // Create the arguments to the callable function.
      val data = hashMapOf(
          &quot;registrationToken&quot; to registrationToken
      )
      Log.d(TAG, &quot;callUser data input: $data&quot;)
      return Firebase.functions
          .getHttpsCallable(&quot;callUser&quot;)
          .call(data)
          .continueWith { task -&gt;
              val result = task.result?.data as String
              result
          }
  }
  </code></pre>
  <h1>Exception Handling from function</h1>
  <pre><code>makeCall(registrationToken)
  .addOnCompleteListener(OnCompleteListener { task -&gt;
      if (!task.isSuccessful) {
          val e = task.exception
          if (e is FirebaseFunctionsException) {
              val code = e.code
              val details = e.details
              Log.w(TAG, &quot;$code&quot;)
          }
          // [START_EXCLUDE]
          Log.w(TAG, &quot;addMessage:onFailure&quot;, e)
          showSnackbar(&quot;An error occurred.&quot;)
          return@OnCompleteListener
          // [END_EXCLUDE]
      }
      // [START_EXCLUDE]
      val result = task.result
      Log.d(TAG,&quot;MakeCall result: $result&quot;)
      val intent = Intent(activity, VideoActivity::class.java)
      startActivity(intent)
      // [END_EXCLUDE]
  })
  </code></pre>
  <p>I have been able to write simple https.onRequest() functions which work as expected but I cannot figure out what I am doing wrong with this callback function.</p>
  <h1>Logs</h1>
  <pre><code>W/HomeFragment: NOT_FOUND
  W/HomeFragment: addMessage:onFailure
  com.google.firebase.functions.FirebaseFunctionsException: NOT_FOUND
      at com.google.firebase.functions.FirebaseFunctions$2.onResponse(com.google.firebase:firebase- 
      functions@@19.0.2:281)
      at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
      at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
      at java.lang.Thread.run(Thread.java:919)
  </code></pre>
  <p>I am using the Firebase emulator to test, there are no logs from that as the function never gets called successfully.</p>