Describe the bug
When calling .call trying to get an error (i.e. with wrong parameters, wrong function name or wrong region) I'm getting a PlatformException instead of a CloudFunctionsException
To Reproduce
This is the function that actually call .call
Future<num> _simpleFunction(String param1, String param2) async {
final HttpsCallable _simpleFunction =
CloudFunctions(region: "europe-west1")
.getHttpsCallable(functionName: 'simpleFunction');
try {
final HttpsCallableResult response = await _addUserRemainder
.call(<String, dynamic>{'param1': param1, 'param2': param2});
return response.data['result'];
} on CloudFunctionsException catch (e) {
print('catched $e');
rethrow;
}
}
And this is where I call _simpleFunction
try {
num balance;
balance =
await _simpleFunction('param', 'param2');
}
} catch (error) {
print('Main block $error');
}
And I always get:
I/flutter (10343): Main block PlatformException(functionsError, Cloud function failed with exception., {code: INVALID_ARGUMENT, details: null, message: Invalid QR code})
Expected behavior
Reading the implementation of .call function, it should always return a CloudFunctionsException instead.
Additional context
cloud_functions version is 0.4.2
Till the version 0.4.1+6 was working fine.
Any update on this? I'm having the same issue.
I read this stack overflow question and it says that the cloud functions api can only throw HttpsError with certain codes, that flutter can't catch because there isn't a "functionsError" code. I can't change the implementation of the Cloud Function to throw a generic error with "functionsError" code. I need help
Is there info if this is going to be fixed? I have the same issue
the same here
I fixed it at this issue https://github.com/FirebaseExtended/flutterfire/pull/2556 but anyone reviewed it.
6 months and the bug stays, this behaviour break all my tests. Waiting for https://github.com/FirebaseExtended/flutterfire/pull/2556 pull request being aproved. @Salakar @collinjackson @kroikie
Same error here!!
@TahaTesser Could I kindly ping you? This is issue is quite problematic and there's a ready PR (two, actually). The only thing this issue needs is a little bit of :heart:
@cubuspl42
Thanks for the info, will let the team know
Most helpful comment
@TahaTesser Could I kindly ping you? This is issue is quite problematic and there's a ready PR (two, actually). The only thing this issue needs is a little bit of :heart: