简体   繁体   中英

How to use CloudFunctions in a Xamarin project

Is there a tutorial on how to properly call a cloud function using Xamarin.Firebase.iOS.CloudFunctions? Or how to setup a regular http request for it, without the library?

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.

When using a regular http request I get a 500 status, in the logs I see something related to permissions accessing the secret manager (I use it for some api keys).

好的,所以代码没有任何问题,我只是没有向适当的用户授予适当的权限(我在我的云功能中使用了 Secret Manager)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM