firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.5k stars 3.92k forks source link

[cloud_firestore] Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken. #11537

Closed larssn closed 10 months ago

larssn commented 10 months ago

Bug report

Describe the bug I've been seeing these somewhat frequently (maybe 20 ish times in the last week), recently, in our error reporting service (sentry.io).

The error appears out of nowhere, which seems to cause related snapshot listeners to break, and in turn, break the code that relies on them.

Steps to reproduce

Never seen it personally, but I'm hoping we can keep the issue open, so people can chime in.

Additional context

From what I can see in Sentry, only Android is affected. I have an incomplete list of devices where it has happened. It is hard to track, because the error logged isn't the actual error, but an error born from it. I'll see if I can improve this error logging in subsequent versions of our app.

Android 12:

It has happened for quite a while, in small amounts. Not sure which version of cloud_firestore it first showed up.

We're using no special configuration parameters for Firestore, only:

// Following is run in main.dart, before Flutter is even initialized using `runApp`.
await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
);

Where DefaultFirebaseOptions.currentPlatform is the autogenerated file, that contains our firebase config.

Sorry I don't have much more to contribute with. I've done a search here in the issue tracker, and this is clearly not an isolated issue.

The issue is high priority to us, but not critical as users seem to figure out that they need to restart the app.

The complete error and it's tiny stack trace:

[cloud_firestore/internal] Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken.
#0      EventChannelExtension.receiveGuardedBroadcastStream (package:_flutterfire_internals/src/exception.dart:67)
#1      MethodChannelDocumentReference.snapshots.<anonymous closure> (package:cloud_firestore_platform_interface/src/method_channel/method_channel_document_reference.dart:117)

We've added the following to our proguard.pro file: -keep class io.grpc.** {*;} Not sure if it does anything. Will keep an eye on it.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand **Note that we can't upgrade to the latest Flutter since our app in huge, and we're still not null safe.** ``` Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.7.12, on macOS 13.5.1 22G90 darwin-arm64, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.3) [✓] VS Code (version 1.81.1) [✓] Connected device (3 available) [✓] HTTP Host Availability • No issues found! ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 2.19.6 Flutter SDK 3.7.12 dependencies: - android_id 0.3.4 [flutter] - animated_text_kit 4.2.2 [flutter characters] - audioplayers 4.0.1 [audioplayers_android audioplayers_darwin audioplayers_linux audioplayers_platform_interface audioplayers_web audioplayers_windows file flutter http meta path_provider synchronized uuid] - bloc 7.2.1 [meta] - built_collection 5.1.1 - built_value 8.5.0 [built_collection collection fixnum meta] - cached_network_image 3.2.3 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web] - cloud_firestore 4.9.1 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - country_pickers 2.0.0 [flutter] - crypto 3.0.3 [typed_data] - cupertino_icons 1.0.6 - dart_date 1.2.2 [intl timeago] - decimal 2.3.3 [rational] - device_info_plus 9.0.3 [device_info_plus_platform_interface ffi file flutter flutter_web_plugins meta win32 win32_registry] - drag_and_drop_gridview 2.0.1 [flutter] - expansion_widget 0.0.3 [flutter] - firebase_auth 4.9.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 2.15.1 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_storage 11.2.6 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - flutter 0.0.0 [characters collection js material_color_utilities meta vector_math sky_engine] - flutter_bloc 7.3.3 [flutter bloc provider] - flutter_dotenv 5.1.0 [flutter] - flutter_html 3.0.0-beta.2 [html csslib collection list_counter flutter] - flutter_keyboard_visibility 5.4.3 [meta flutter_keyboard_visibility_platform_interface flutter_keyboard_visibility_linux flutter_keyboard_visibility_macos flutter_keyboard_visibility_web flutter_keyboard_visibility_windows flutter] - flutter_localizations 0.0.0 [flutter intl characters clock collection js material_color_utilities meta path vector_math] - flutter_material_color_picker 1.1.0+2 [flutter] - flutter_nfc_acs 0.4.6 [flutter flutter_plugin_android_lifecycle] - flutter_nfc_kit 3.3.1 [flutter flutter_web_plugins json_annotation ndef convert logging js] - flutter_riverpod 2.3.7 [collection flutter meta riverpod state_notifier] - flutter_slidable 2.0.0 [flutter] - flutter_timezone 1.0.7 [flutter_web_plugins flutter js] - flutter_vibrate 1.3.0 [flutter] - geography 1.1.5 [meta http path archive latlong2 diacritic equatable collection json_annotation] - html_unescape 2.0.0 - http 0.13.6 [async http_parser meta] - image 4.0.17 [archive meta xml] - image_picker 0.8.9 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_linux image_picker_macos image_picker_platform_interface image_picker_windows] - in_app_update 4.2.0 [flutter] - internet_connection_checker 1.0.0+1 - intl 0.17.0 [clock path] - meta 1.8.0 - network_info_plus 4.0.2 [collection nm flutter flutter_web_plugins meta network_info_plus_platform_interface win32 ffi] - package_info_plus 4.1.0 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface win32] - path_provider 2.1.1 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows] - phone_number 1.0.0 [flutter meta] - positioned_tap_detector_2 1.0.4 [flutter] - qr_flutter 4.1.0 [flutter qr] - random_string 2.3.1 - rational 2.2.2 - reorderables 0.6.0 [flutter] - retry 3.1.1 - rxdart 0.27.7 - sentry_flutter 7.9.0 [flutter flutter_web_plugins sentry package_info_plus meta] - shared_preferences 2.2.1 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - sprintf 7.0.0 - time 2.1.3 [clock] - timezone 0.9.2 [path] - url_launcher 6.1.11 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - uuid 3.0.7 [crypto] - validators 3.0.0 - xml 6.2.2 [collection meta petitparser] dev dependencies: - build_runner 2.3.3 [args async analyzer build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml] - built_value_generator 8.5.0 [analyzer build build_config built_collection built_value collection source_gen] - flutter_lints 2.0.3 [lints] transitive dependencies: - _fe_analyzer_shared 61.0.0 [meta] - _flutterfire_internals 1.3.5 [collection firebase_core firebase_core_platform_interface flutter meta] - analyzer 5.13.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - archive 3.3.7 [crypto path pointycastle] - args 2.4.2 - async 2.10.0 [collection meta] - audioplayers_android 3.0.2 [audioplayers_platform_interface flutter] - audioplayers_darwin 4.1.0 [audioplayers_platform_interface flutter] - audioplayers_linux 2.1.0 [audioplayers_platform_interface flutter] - audioplayers_platform_interface 5.0.1 [flutter meta plugin_platform_interface] - audioplayers_web 3.1.0 [audioplayers_platform_interface flutter flutter_web_plugins js] - audioplayers_windows 2.0.2 [audioplayers_platform_interface flutter] - boolean_selector 2.1.1 [source_span string_scanner] - build 2.3.1 [analyzer async convert crypto glob logging meta path] - build_config 1.1.1 [checked_yaml json_annotation path pubspec_parse yaml] - build_daemon 3.1.1 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 2.3.1 [analyzer async build collection convert crypto graphs logging package_config path pool pub_semver stream_transform yaml] - build_runner_core 7.2.7+1 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pool timing watcher yaml] - cached_network_image_platform_interface 2.0.0 [flutter flutter_cache_manager] - cached_network_image_web 1.0.2 [flutter flutter_cache_manager cached_network_image_platform_interface] - characters 1.2.1 - checked_yaml 2.0.3 [json_annotation source_span yaml] - clock 1.1.1 - cloud_firestore_platform_interface 5.16.0 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 3.7.0 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - code_builder 4.6.0 [built_collection built_value collection matcher meta] - collection 1.17.0 - convert 3.1.1 [typed_data] - cross_file 0.3.3+5 [js meta] - csslib 0.17.3 [source_span] - dart_style 2.3.2 [analyzer args path pub_semver source_span] - dbus 0.7.8 [args ffi meta xml] - device_info_plus_platform_interface 7.0.0 [flutter meta plugin_platform_interface] - diacritic 0.1.4 - equatable 2.0.5 [collection meta] - fake_async 1.3.1 [clock collection] - ffi 2.0.2 - file 6.1.4 [meta path] - file_selector_linux 0.9.2+1 [cross_file file_selector_platform_interface flutter] - file_selector_macos 0.9.3+2 [cross_file file_selector_platform_interface flutter] - file_selector_platform_interface 2.6.1 [cross_file flutter http plugin_platform_interface] - file_selector_windows 0.9.3+1 [cross_file file_selector_platform_interface flutter] - firebase_auth_platform_interface 6.18.0 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.8.0 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser js meta] - firebase_core_platform_interface 4.8.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.7.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_storage_platform_interface 4.4.5 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.6.6 [_flutterfire_internals async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta] - fixnum 1.1.0 - flutter_blurhash 0.7.0 [flutter] - flutter_cache_manager 3.3.1 [clock collection file flutter http path path_provider rxdart sqflite uuid] - flutter_keyboard_visibility_linux 1.0.0 [flutter_keyboard_visibility_platform_interface flutter] - flutter_keyboard_visibility_macos 1.0.0 [flutter_keyboard_visibility_platform_interface flutter] - flutter_keyboard_visibility_platform_interface 2.0.0 [flutter meta plugin_platform_interface] - flutter_keyboard_visibility_web 2.0.0 [flutter_keyboard_visibility_platform_interface flutter_web_plugins flutter] - flutter_keyboard_visibility_windows 1.0.0 [flutter_keyboard_visibility_platform_interface flutter] - flutter_plugin_android_lifecycle 2.0.16 [flutter] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters collection js matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - frontend_server_client 3.2.0 [async path] - glob 2.1.2 [async collection file path string_scanner] - graphs 2.3.1 [collection] - html 0.15.4 [csslib source_span] - http_multi_server 3.2.1 [async] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - image_picker_android 0.8.7+5 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface] - image_picker_for_web 2.2.0 [flutter flutter_web_plugins image_picker_platform_interface mime] - image_picker_ios 0.8.8+2 [flutter image_picker_platform_interface] - image_picker_linux 0.2.1+1 [file_selector_linux file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_macos 0.2.1+1 [file_selector_macos file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_platform_interface 2.9.1 [cross_file flutter http plugin_platform_interface] - image_picker_windows 0.2.1+1 [file_selector_platform_interface file_selector_windows flutter image_picker_platform_interface] - io 1.0.4 [meta path string_scanner] - js 0.6.5 [meta] - json_annotation 4.8.1 [meta] - latlong2 0.8.2 [intl] - lints 2.0.1 - list_counter 1.0.2 - logging 1.2.0 - matcher 0.12.13 [meta stack_trace] - material_color_utilities 0.2.0 - mime 1.0.4 - ndef 0.3.1 [uuid] - nested 1.0.0 [flutter] - network_info_plus_platform_interface 1.1.3 [flutter meta plugin_platform_interface] - nm 0.5.0 [dbus] - octo_image 1.0.2 [flutter flutter_blurhash] - package_config 2.1.0 [path] - package_info_plus_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - path 1.8.2 - path_provider_android 2.2.0 [flutter path_provider_platform_interface] - path_provider_foundation 2.3.1 [flutter path_provider_platform_interface] - path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_platform_interface 2.1.1 [flutter platform plugin_platform_interface] - path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32] - petitparser 5.1.0 [meta] - platform 3.1.2 - plugin_platform_interface 2.1.6 [meta] - pointycastle 3.7.3 [collection convert js] - pool 1.5.1 [async stack_trace] - provider 6.0.5 [collection flutter nested] - pub_semver 2.1.4 [collection meta] - pubspec_parse 1.2.3 [checked_yaml collection json_annotation pub_semver yaml] - qr 3.0.1 [meta] - riverpod 2.3.7 [meta stack_trace state_notifier] - sentry 7.9.0 [http meta stack_trace uuid] - shared_preferences_android 2.2.1 [flutter shared_preferences_platform_interface] - shared_preferences_foundation 2.3.4 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.3.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_platform_interface 2.3.1 [flutter plugin_platform_interface] - shared_preferences_web 2.2.1 [flutter flutter_web_plugins shared_preferences_platform_interface] - shared_preferences_windows 2.3.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - shelf 1.4.1 [async collection http_parser path stack_trace stream_channel] - shelf_web_socket 1.0.4 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - source_gen 1.3.2 [analyzer async build dart_style glob path source_span yaml] - source_span 1.9.1 [collection path term_glyph] - sqflite 2.2.8+4 [flutter sqflite_common path] - sqflite_common 2.4.5+1 [synchronized path meta] - stack_trace 1.11.0 [path] - state_notifier 1.0.0 [meta] - stream_channel 2.1.1 [async] - stream_transform 2.1.0 - string_scanner 1.2.0 [source_span] - synchronized 3.1.0 - term_glyph 1.2.1 - test_api 0.4.16 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - timeago 3.3.0 [intl] - timing 1.0.1 [json_annotation] - typed_data 1.3.2 [collection] - url_launcher_android 6.0.39 [flutter url_launcher_platform_interface] - url_launcher_ios 6.1.5 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.6 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.7 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.1.4 [flutter plugin_platform_interface] - url_launcher_web 2.0.19 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.8 [flutter url_launcher_platform_interface] - vector_math 2.1.4 - watcher 1.0.2 [async path] - web_socket_channel 2.4.0 [async crypto stream_channel] - win32 4.1.4 [ffi] - win32_registry 1.1.0 [ffi win32] - xdg_directories 1.0.3 [meta path] - yaml 3.1.2 [collection source_span string_scanner] ```

danagbemava-nc commented 10 months ago

Hi @larssn, thanks for filing this. A few questions

larssn commented 10 months ago

Hey @danagbemava-nc thanks for replying, I've updated the OP with more info.

danagbemava-nc commented 10 months ago

Hi @larssn, can you try reaching out to firebase support to see if they can provide any help?

The flutterfire_* plugins are wrappers around the native plugins so this seems like its coming from the native plugin instead of the cloud_firestore plugin

larssn commented 10 months ago

I know from experience that Firebase Support is useless unless you pay for it. They waste your time until you give up, sadly.

But are you saying that the error comes from further down, and not the Dart/Platform Channel layer?

danagbemava-nc commented 10 months ago

But are you saying that the error comes from further down, and not the Dart/Platform Channel layer?

Yes, the internal error code from what I gather is for "serious" issues. The plugin is only surfacing it to you.

larssn commented 10 months ago

Hm ok.

Well I've tried reporting many issues of a serious nature to Firebase Support (including this one I believe), never with any luck. They always require a reproduction, which isn't always possible.

danagbemava-nc commented 10 months ago

For now, I'll be closing this since there isn't much action to take from our end.

If you are able to get a repro, we would love to revisit this in the future.

Thank you