- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在 FlutterFire docs 之后从我的 Flutter 应用程序调用一个非常简单的云函数,但我收到了一个非常不可读的错误。无论我是使用模拟器,还是尝试调用使用 Firebase 完全部署的函数,都会出现错误。
我的云函数代码:
import * as functions from "firebase-functions";
export const ping = functions.https.onCall(() => ({ ping: "pong" }));
还有我在 main.dart
中的 Flutter 代码:
import 'package:cloud_functions/cloud_functions.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:my_app/firebase_options.dart';
import 'package:my_app/my_app.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); // Uses options configured by FlutterFire CLI
// Does not work regardless of whether this line is commented out
// FirebaseFunctions.instance.useFunctionsEmulator('localhost', 5001);
HttpsCallable ping = FirebaseFunctions.instance.httpsCallable('ping');
await ping(); // Exception thrown on this line
runApp(const MyApp());
}
运行此代码时,我得到一个FirebaseFunctionsException([firebase_functions/17999] 发生内部错误,打印并检查错误详细信息以获取更多信息。
错误:
即使我深入调用堆栈,我也无法获得任何有用的信息。在MethodChannelHttpsCallable的call
方法中设置断点向我展示了在调用 MethodChannelFirebaseFunctions.channel.invokeMethod
方法时抛出了异常,但我看不出任何立即明显的失败原因。
我在我的应用程序中使用其他 FlutterFire 库(特别是 Auth 和 Firestore),使用模拟器和部署的 Firebase 项目都没有任何问题。
最佳答案
我找到了解决这个问题的方法。在 Emulator UI 中,在 Authentication 选项卡中添加一个用户,并让您的 App 只用他登录一次。然后您可以注销并删除该用户。之后我的函数停止给出错误 17999 并且它正常工作。
关于firebase - flutter 火 : Calling cloud function throws an internal error with no details - FirebaseFunctionsException [firebase_functions/17999],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71028259/
我正在尝试调用 Firebase https 可调用函数,但我在 Android Studio 中收到一条错误消息“com.google.firebase.functions.FirebaseFunc
无法执行 Google Cloud Functions Android 客户端调用。 我从云控制台创建 Cloud Function,并在云控制台上进行测试。 但在 Android 客户端应用程序上,
我正在尝试在 FlutterFire docs 之后从我的 Flutter 应用程序调用一个非常简单的云函数,但我收到了一个非常不可读的错误。无论我是使用模拟器,还是尝试调用使用 Firebase 完
我是一名优秀的程序员,十分优秀!