我如何正确设置我的颤抖项目以调用云功能?
设置
几个月前,我开始学习颤抖的 ,现在正在试图将现有的火箱项目集成到一个新的扑朔迷离项目中。我在Firebase控制台中创建了新应用,然后遵循Google的 setup指令。我正在导入必要的库,并将flutter默认应用程序用作我的操场。我已经设置了一个按钮,以便当您按下它时,它会调用_DofireBasestuff()
喜欢这样的:
Future<void> _doFirebaseStuff() async {
HttpsCallable callable = FirebaseFunctions.instance.httpsCallable("loadNews");
var data = await callable.call(); // This line causes the error
print(data);
}
问题
当然,预期的行为是调用云功能并返回数据。
最终实际发生的是丢弃以下错误:firebaseFunctionSexception([[firebase_functions/1]操作无法完成。操作不允许
。我找不到在扑朔迷离中找到任何东西 的堆栈跟踪源代码
或Firebase文档,也
没有任何相关
- 。我项目中任何地方的plist文件)
- appCheck正在搞砸事情
- 我不认为这是一个问题,因为:
- 我已经使用(我认为是)AppCheck的正确实现 测试了相同的设置
- 我没有得到
失败的前提:该请求必须来自经过验证的应用
Message - 函数调用未显示在云功能日志中,因此我认为该请求甚至不会被拒绝,然后立即失败
- 我不认为这是一个问题,因为:
- 在云控制台上失败了IAM权限
- 我不认为这是一个问题,因为:
- 我成功地在另一个应用程序中使用了这些功能
- 函数调用甚至没有显示在控制台日志中
- 我不认为这是一个问题,因为:
,但是我可能没有想到其他事情。
环境
- 语言:飞镖
- 扑来版本:3.0.2
- 目标平台:Macos
- PubSpec.YAML数据:
- cloud_functions: ^3.2.17
- firebase_core: ^1.18.0
我要撕掉我的头发,试图调试这个问题,真的很感谢您的任何帮助!
The setup
I started learning Flutter a few months ago and am now trying to integrate an existing Firebase project into a new Flutter project. I created the new app in the Firebase Console, and followed Google's setup instructions. I am importing the necessary libraries and am using the flutter default app as a playground for me. I have a button set up so that when you press it, it calls _doFirebaseStuff()
like so:
Future<void> _doFirebaseStuff() async {
HttpsCallable callable = FirebaseFunctions.instance.httpsCallable("loadNews");
var data = await callable.call(); // This line causes the error
print(data);
}
The problem
The expected behavior, of course, is to call the Cloud Function and return the data.
What ends up actually happening is the following error being thrown: FirebaseFunctionsException ([firebase_functions/1] The operation couldn’t be completed. Operation not permitted
. I haven't been able to find anything in the Flutter or Firebase documentation, nor anything relevant in the source code around the stack trace.
Troubleshooting
I have suspicions that one of the following reasons can be at the root of this issue:
- Improper configuration of Firebase (I don't have a Google-Services.plist file anywhere in my project)
- AppCheck is screwing things up
- I don't think this is the issue because:
- I have tested the same setup with (what I think was) a correct implementation of AppCheck
- I am not getting a
Failed Precondition: The request must come from a verified app
message - The function call is not showing up in the Cloud Function logs, so I don't think the request is even being made and then denied, it fails right away
- I don't think this is the issue because:
- Improper IAM permissions on the Cloud Console
- I don't think this is the issue because:
- I am successfully using these functions in a different app
- The function call is not even showing up in the Console logs
- I don't think this is the issue because:
However there could be other things that I'm not thinking of.
Environment
- Language: Dart
- Flutter Version: 3.0.2
- Target platform: MacOS
- pubspec.yaml data:
- cloud_functions: ^3.2.17
- firebase_core: ^1.18.0
I'm tearing my hair out trying to debug this and would really appreciate any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以关注 and
这些说明将帮助您设置
google-services.plist
文件。另外,如果按照说明设置应用程序后,如果您仍然面临错误,请将您的呼叫围绕在函数上:
并在日志中分享您获得的内容(错误代码,详细信息,详细信息和消息将在日志)。
Can you follow this and this ?
These instructions will help you setup the
Google-Services.plist
file.Also, if after setting up your app as per the instructions, if you still face errors, please surround your call to the function like this:
And share what you get in the logs (The error code, details and message will be printed in the logs).