title: Unhandled Exception: PlatformException(functionsError, Cloud function failed with exception., {message: PERMISSION_DENIED,)
body: <p>Here is my cloud function </p>
  
  <pre><code>exports.addUser = functions.https.onCall((data, context) =&gt; {
    console.log(`Hi ${data}`);
    return `Hi there ${data["name"]}`;
  });
  </code></pre>
  
  <p>Here is my code in flutter on button click</p>
  
  <pre><code>final HttpsCallable callable = CloudFunctions.instance
          .getHttpsCallable(functionName: 'addUser')
            ..timeout = const Duration(seconds: 30);
  
   try {
                        final HttpsCallableResult result = await callable
                            .call(&lt;String, dynamic&gt;{"name": "Pritish"});
                        debugPrint(result.data);
                      } on CloudFunctionsException catch (e) {
                        debugPrint('caught generic exception');
                        debugPrint(
                            "${e.message.toString()} ${e.code.toString()} ${e.details.toString()} ${e.toString()}");
                      }
  </code></pre>
  
  <p>But i keep getting following error <code>Unhandled Exception: PlatformException(functionsError, Cloud function failed with exception., {message: PERMISSION_DENIED, details: null, code: PERMISSION_DENIED})</code></p>
  
  <p>I am not accessing any of the <code>firestore</code> database data so why is it showing permission error. Also i am using other services of <code>firebase</code> like <code>auth,signin, firestore,storage</code> and they seem to work fine for me. I have deployed the function correctly as well. I have other functions for FCM as well and they seem to be working fine. The setup for Android for Firebase is done correctly as well</p>