'Flutter - Firebase callable functions with region not working

we currently facing the problem in our flutter app, that httpsCallable functions which are defined with a region, in our case "europe-west1", is throwing an exception:

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [firebase_functions/internal] Response is not valid JSON object.

#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
<asynchronous suspension>
#2      MethodChannelHttpsCallable.call (package:cloud_functions_platform_interface/src/method_channel/method_channel_https_callable.dart:23:24)
<asynchronous suspension>
#3      HttpsCallable.call (package:cloud_functions/src/https_callable.dart:35:37)
<asynchronous suspension>

#0      MethodChannelHttpsCallable.call (package:cloud_functions_platform_interface/src/method_channel/method_channel_https_callable.dart:39:7)
<asynchronous suspension>
#1      HttpsCallable.call (package:cloud_functions/src/https_callable.dart:35:37)
<asynchronous suspension>

As far, as we tested, it makes no difference, if we define the region in flutter accordingly to docs:

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

Or directly in the cloud function:

exports.myCallableFunction = functions.region("europe-west1").https.onCall((data, context) => {
   // ... return result
});

If we remove the region on both lines above, the callable function is working and returning the expected result.

Is there something, what I miss or is there currently an issue in flutter itself?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source