flutter - 无法调用函数 cloud_functions
问题描述
我不断得到:
颤振:捕获通用异常
颤振:异常:无法调用函数 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);
}
解决方案
非易失性!我发现当我在 firebase 上部署我的云功能时,我为 https 请求而不是为调用部署了一个。对于未来的其他人,在制定部署方法时使用 functions.https.onCall。
推荐阅读
- android - 如何降低 Android CameraX ImageAnalysis 的帧率?
- sql - TSQL:在 INSERT 之后运行 exec
- spring - 在这种情况下如何模拟 ReloadableResourceBundleMessageSource
- javascript - 如何在 DOM 中的新数组元素上使用现有函数
- apache-flink - 如何在不删除先前值的情况下更新 MapState 上的值?
- python - 使用 pyspark 和正则表达式解析多行日志
- java - netty 重试连接客户端将冻结
- c# - EF Core - 将文件保存到数据库而不先读取 RAM
- xml - XSLT document() 不调用特定节点
- javascript - UpdatePanel 回发删除使用 javascript 所做的更改