Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot change region of functions on flutter

Ive switched my functions regions from the US default and I cannot find a way to call them in flutter?

Is there a method of setting the region on the CloudFunctions instance or when you make the function calls

Thanks for the help.


I have managed to get this to work

 CloudFunctions(app: FirebaseApp.instance, region: "europe-west2").getHttpsCallable(functionName: functionName);

But I am no longer using the singleton.

Is this a bad solution?

like image 680
ebg11 Avatar asked Oct 21 '25 03:10

ebg11


2 Answers

I don't see what's bad about it. You're doing exactly what you have to do. Just retain the result of CloudFunctions(app: FirebaseApp.instance, region: "europe-west2") in your own singleton if you want to reuse it.

like image 178
Doug Stevenson Avatar answered Oct 24 '25 08:10

Doug Stevenson


I think the official solution is to use instanceFor:

final result =
          await FirebaseFunctions.instanceFor(region: 'europe-west1').httpsCallable('addRental').call(jsonEncode(data));

worked for me, instead of

final result =
          await FirebaseFunctions.instance.httpsCallable('addRental').call(jsonEncode(data));
like image 41
G-Unit Avatar answered Oct 24 '25 09:10

G-Unit