TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
220 stars 49 forks source link

Functions GetHttpsCallable not working on iOS or Android #292

Closed robertmaxted closed 6 months ago

robertmaxted commented 6 months ago

Hi Guys,

I am trying to migrate my functions over from using http client etc, to using the CrossFireBaseFunctions. However I am getting these errors:

On iOS: {Foundation.NSErrorException: Error Domain=com.firebase.functions Code=5 "NOT FOUND" UserInfo={NSLocalizedDescription=NOT FOUND} at Plugin.Firebase.Functions.Platforms.iOS.HttpsCallableWrapper.d__41[[System.Collections.Generic.List1[[Vanity.Models.Business, Vanity, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()\n at...

On Android: {Firebase.Functions.FirebaseFunctionsException: NOT_FOUND at Plugin.Firebase.Functions.Platforms.Android.HttpsCallableWrapper.d__41[[System.Collections.Generic.List1[[Vanity.Models.Business, Vanity, Version=1.0.0.0, Culture=neutral, PublicKeyTok…}

The Call:

`var jsonData = JsonConvert.SerializeObject(data); // Convert data dictionary to JSON string

var functions = CrossFirebaseFunctions.Current;

var businesses = await functions.GetHttpsCallable("someFunction").CallAsync<List>(jsonData);`

It throws the error on the call.

I have checked that the function exists in firebase functions.

Firestore, auth etc all work as expected, it is just cloud functions. I have also checked that there aren't any restrictions on the API keys, they are all ok.. I am stumped. Any advice or time would be greatly appreciated.

Kind regards, Rob

@TobiasBuchholz @AdamEssenmacher

AdamEssenmacher commented 6 months ago

I'm going to guess your functions are outside us-central1. The plugin doesn't support this OOTB but it would be a small PR.

robertmaxted commented 6 months ago

Ahh!! I see, thanks @AdamEssenmacher ! Yes They are in europe-west2.. Is there anything I can do to help with this?

AdamEssenmacher commented 6 months ago

If you're comfortable submitting a PR, that's probably going to be the quickest way it gets done. CrossFirebaseFunctions.CreateInstance just needs an overload to accept the region and the two platform implementations updated to implement.

robertmaxted commented 6 months ago

Thanks @AdamEssenmacher I have made the changes: https://github.com/TobiasBuchholz/Plugin.Firebase/pull/293

AdamEssenmacher commented 6 months ago

Should be set for the next release

robertmaxted commented 6 months ago

@AdamEssenmacher Thanks for approving etc. That's great news! When is the next release??

robertmaxted commented 6 months ago

@AdamEssenmacher Also, thanks for the clean-up and changes.

AdamEssenmacher commented 6 months ago

@TobiasBuchholz has the release keys... so whenever he gets around to it.

robertmaxted commented 6 months ago

@AdamEssenmacher Thanks for the info. @TobiasBuchholz Any idea roughly when you will be releasing next? Many thanks.

TobiasBuchholz commented 6 months ago

Hi @robertmaxted, I've just released the new package versions Plugin.Firebase.Functions 2.0.3 and Plugin.Firebase 2.0.14 that contain your PR 🚀 Thanks for your contribution! :)

robertmaxted commented 6 months ago

Hi @robertmaxted,

I've just released the new package versions Plugin.Firebase.Functions 2.0.3 and Plugin.Firebase 2.0.14 that contain your PR 🚀 Thanks for your contribution! :)

@TobiasBuchholz Awesome! You Hero! Thanks for getting that done so fast Tobias 👍

TobiasBuchholz commented 6 months ago

Sure, no problem! I would say it was a nice team effort! :D

robertmaxted commented 6 months ago

Sure, no problem! I would say it was a nice team effort! :D

Yeah for sure! Thanks again also @AdamEssenmacher