我有一些看似非常奇怪的行為。我一直在關注有關將firebase集成到我的flutter應用程序中的多個教程。我正在嘗試做一些非常簡單的事情。當用戶按下按鈕時,將創建一個“會話”文檔。我有這個 :index.jsconst functions = require('firebase-functions');const admin = require('firebase-admin');admin.initializeApp(functions.config().firebase);exports.addSession = functions.https.onCall((data, context) => { const sessions = admin.firestore().collection('sessions'); return sessions.add({ game: data['game'], rules: data['rules'], password: data['password'], roomCode: data['roomCode'], playerIds: data['playerIds'] });});在Flutter中調用時,數據已成功寫入數據庫(我可以在控制臺中看到它),但我也總是收到此錯誤:[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: PlatformException(functionsError, Firebase function failed with exception., {message: INTERNAL, code: INTERNAL})當我檢查 Firebase 日志時,我看到以下內容:顫動調用:final HttpsCallable callable = CloudFunctions.instance.getHttpsCallable(functionName: 'addSession'); await callable.call(<String, dynamic>{ 'game': game, 'rules': 'default', 'password': password, 'roomCode': _roomCode, 'playerIds': [123456], });對此非常困惑,結果似乎無關緊要。這是非常簡單的代碼!maximum stack call size exceeded還想知道這是否與我遇到的閱讀問題有關,我將在另一篇文章中詢問。
flutter & firebase:寫成功,有錯誤?
千巷貓影
2022-08-27 15:08:50