xamarin / GoogleApisForiOSComponents

MIT License
225 stars 161 forks source link

How to Use Xamarin.Firebase.iOS.CloudFunctions #496

Closed endarea closed 3 years ago

endarea commented 3 years ago

Is there a tutorial on how to properly call a cloud function?

I set up my function like this:

exports.IsAppleSubscriptionActive = functions.https.onCall(async (data, context) => {});

and deployed it like this:

firebase deploy --only functions

and got and url like this:

https://[region]-[project-id].cloudfunctions.net/IsAppleSubscriptionActive

On the client I installed the nuget and I try calling:

var result = await CloudFunctions.DefaultInstance.HttpsCallable("IsAppleSubscriptionActive").CallAsync(payloadToSend);

where payloadToSend is a NSDictionary. I get

Foundation.NSErrorException: Error Domain=com.firebase.functions Code=13 "INTERNAL" UserInfo={NSLocalizedDescription=INTERNAL}

What am I missing? I feel like the native tutorials aren't helping either. Is there something else I need to set up first?

endarea commented 3 years ago

Ok, so there was nothing wrong with the code, I just wasn't giving the proper permissions to the proper user (I was using Secret Manager in my cloud function)