【问题标题】:Unable to call function cloud_functions无法调用函数 cloud_functions
【发布时间】:2019-12-10 16:07:27
【问题描述】:

我不断得到:

flutter:捕获一般异常

flutter:异常:无法调用函数 helloWorld。

我一直在使用 cloud_functions 0.4.1

CloudFunctions cf = CloudFunctions(region: 'us-central1');
  try {
    HttpsCallable callable = cf.getHttpsCallable(
      functionName: 'helloWorld',
    );

    dynamic resp = await callable.call();

    print(resp);
  } on CloudFunctionsException catch (e) {
    print('caught firebase functions exception');
    print(e.code);
    print(e.message);
    print(e.details);
  } catch (e) {
    print('caught generic exception');
    print(e);
  }

【问题讨论】:

  • 您正在使用 HTTP 可调用函数。为什么不进行标准 REST 调用?

标签: flutter


【解决方案1】:

非易失性!我发现当我在 firebase 上部署我的云功能时,我为 https 请求而不是为调用部署了一个。对于未来的其他人,在制定部署方法时使用 functions.https.onCall。

【讨论】:

    猜你喜欢
    • 2020-06-05
    • 2020-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-20
    • 2014-09-06
    • 1970-01-01
    相关资源
    最近更新 更多