Skip to content
Advertisement

Callable Cloud Function error: Response is missing data field, when trying to call cloud function written in python from flutter app

I’ve been stuck for a few days trying to call a cloud function that was written in Python that takes no parameters from my flutter app, but I keep getting an error that says ‘Response is missing data field’. This is confusing me because the function takes no parameters so I’m wondering if I’m missing something.

This is what the python function looks :

def create_algorand_account(request):
request_json = request.get_json(silent=True)

returned_dict = {'user_address':address,'user_passphrase':mnemonic}
return returned_dict

This is what the call looks like:

Future<void> createHotWallet() async {
String id = getRandomString(30);
final HttpsCallable callable = FirebaseFunctions.instance.httpsCallable(
  'createAlgorandAccount',
);

try {
  final HttpsCallableResult result = await callable.call();
  final hotWallet = HotWallet(
    id: id,
    address: result.data['user_address'],
    passphrase: result.data['user_passphrase'],
    webblenAmount: 0,
    algoAmount: 0,
  );
  await hotWalletsRef.doc(id).set(hotWallet.toMap()).catchError((e) {
    return e.message;
  });
} on FirebaseFunctionsException catch (e) {
  print(e);
} catch (e) {
  print(e);
}

}

Advertisement

Answer

Callable Cloud Functions can only be implemented in Node.js at the moment. What you have in your Python code is a regular HTTP Cloud Function, which you should call with a regular HTTP request from your code.

Advertisement