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.72k stars 3.97k forks source link

šŸ› [firebase_database] Infinity loading after FirebaseDatabase await #11944

Closed ViniciusMacedoCamara closed 11 months ago

ViniciusMacedoCamara commented 11 months ago

Bug report

It consists in a fetch profile from Firebase Realtime Database and after get the key value from the database the Flutter app awaits for its value child called 'client'. The odd it's that only occurs on Android Emulator devices, tested from the API Level 30 to the latest. On a Android physical device and iOS both physical and simulator works fine.

Steps to reproduce

Steps to reproduce the behavior:

  1. Have a Firebase project with Realtime Database
  2. Fetch the database from Flutter app
  3. See error or incorrect behavior

Expected behavior

The expected behavior is the value being retrieved from the database

Sample project

DatabaseReference ref = database.ref('clientCRM');
DatabaseEvent event = await ref.orderByChild('client').equalTo(name).once();

The app doesn't pass from this await line


Additional context

It's very IMPORTANT to mention that this started to occur after November 23rd, before that the expected behaviour occurred like a charm.

The log below is something that our team could notice from the day that everything started to work incorrectly. We could not notice any of that before nov 23rd.

D/CompatibilityChangeReporter(24353): Compat change id reported: 183155436; UID 10190; state: ENABLED
W/FirebaseRemoteConfig( 4197): Could not update ABT experiments.
W/FirebaseRemoteConfig( 4197): com.google.firebase.abt.AbtException: The Analytics SDK is not available. Please check that the Analytics SDK is included in your app dependencies.
W/FirebaseRemoteConfig( 4197):  at com.google.firebase.abt.FirebaseABTesting.throwAbtExceptionIfAnalyticsIsNull(FirebaseABTesting.java:349)
W/FirebaseRemoteConfig( 4197):  at com.google.firebase.abt.FirebaseABTesting.replaceAllExperiments(FirebaseABTesting.java:120)
W/FirebaseRemoteConfig( 4197):  at com.google.firebase.remoteconfig.FirebaseRemoteConfig.updateAbtWithActivatedExperiments(FirebaseRemoteConfig.java:657)
W/FirebaseRemoteConfig( 4197):  at com.google.firebase.remoteconfig.FirebaseRemoteConfig.processActivatePutTask(FirebaseRemoteConfig.java:608)
W/FirebaseRemoteConfig( 4197):  at com.google.firebase.remoteconfig.FirebaseRemoteConfig.$r8$lambda$jaisR09Ce9JaIIQwbTp50mxBpwc(Unknown Source:0)
W/FirebaseRemoteConfig( 4197):  at com.google.firebase.remoteconfig.FirebaseRemoteConfig$$ExternalSyntheticLambda8.then(Unknown Source:2)
W/FirebaseRemoteConfig( 4197):  at com.google.android.gms.tasks.zzc.run(com.google.android.gms:play-services-tasks@@18.0.2:3)
W/FirebaseRemoteConfig( 4197):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
W/FirebaseRemoteConfig( 4197):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
W/FirebaseRemoteConfig( 4197):  at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47)
W/FirebaseRemoteConfig( 4197):  at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(Unknown Source:4)
W/FirebaseRemoteConfig( 4197):  at java.lang.Thread.run(Thread.java:1012)
D/FRCPlugin( 4197): Sending fetchTimeout: 2
I/FirebaseApp( 7320): Device unlocked: initializing all Firebase APIs for app [DEFAULT]
W/PersistentConnection( 7320): pc_0 - Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding '".indexOn": "client"' at clientCRM to your security and Firebase Database rules for better performance

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` flutter doctor Doctor summary (to see all details, run flutter doctor -v): [āœ“] Flutter (Channel stable, 3.13.2, on macOS 14.0 23A344 darwin-arm64, locale en-BR) [āœ“] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [āœ“] Xcode - develop for iOS and macOS (Xcode 15.0.1) [āœ“] Chrome - develop for the web [āœ“] Android Studio (version 2022.3) [āœ“] VS Code (version 1.82.2) [āœ“] Connected device (4 available) [āœ“] Network resources ā€¢ No issues found! ```

Flutter dependencies

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

Click To Expand ``` flutter pub deps -- --style=compact Dart SDK 3.1.0 Flutter SDK 3.13.2 jira_internal_app 1.0.0+1 dependencies: - cupertino_icons 1.0.6 - dartz 0.10.1 - equatable 2.0.5 [collection meta] - firebase_core 2.21.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_database 10.3.3 [firebase_core firebase_core_platform_interface firebase_database_platform_interface firebase_database_web flutter] - firebase_remote_config 4.3.2 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter] - fl_chart 0.64.0 [equatable flutter] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math web sky_engine] - get 4.6.6 [flutter] - intl 0.18.1 [clock meta path] - json_annotation 4.8.1 [meta] dev dependencies: - build_runner 2.4.6 [analyzer args async 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] - flutter_lints 2.0.3 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math async boolean_selector characters collection material_color_utilities meta source_span stream_channel string_scanner term_glyph web] - json_serializable 6.7.1 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper] transitive dependencies: - _fe_analyzer_shared 64.0.0 [meta] - _flutterfire_internals 1.3.11 [collection firebase_core firebase_core_platform_interface flutter meta] - analyzer 6.2.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - args 2.4.2 - async 2.11.0 [collection meta] - boolean_selector 2.1.1 [source_span string_scanner] - build 2.4.1 [analyzer async convert crypto glob logging meta package_config path] - build_config 1.1.1 [checked_yaml json_annotation path pubspec_parse yaml] - build_daemon 4.0.0 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 2.4.1 [analyzer async build collection convert crypto graphs logging package_config path pool pub_semver stream_transform yaml] - build_runner_core 7.2.11 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta package_config path pool timing watcher yaml] - built_collection 5.1.1 - built_value 8.6.3 [built_collection collection fixnum meta] - characters 1.3.0 - checked_yaml 2.0.3 [json_annotation source_span yaml] - clock 1.1.1 - code_builder 4.7.0 [built_collection built_value collection matcher meta] - collection 1.17.2 - convert 3.1.1 [typed_data] - crypto 3.0.3 [typed_data] - dart_style 2.3.3 [analyzer args path pub_semver source_span] - fake_async 1.3.1 [clock collection] - file 7.0.0 [meta path] - firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.8.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_database_platform_interface 0.2.5+11 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_database_web 0.2.3+11 [firebase_core firebase_core_web firebase_database_platform_interface flutter flutter_web_plugins js] - firebase_remote_config_platform_interface 1.4.10 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_remote_config_web 1.4.10 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins js] - fixnum 1.1.0 - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math web] - frontend_server_client 3.2.0 [async path] - glob 2.1.2 [async collection file path string_scanner] - graphs 2.3.1 [collection] - http_multi_server 3.2.1 [async] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - io 1.0.4 [meta path string_scanner] - js 0.6.7 [meta] - lints 2.1.1 - logging 1.2.0 - matcher 0.12.16 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.5.0 [collection] - meta 1.9.1 - mime 1.0.4 - package_config 2.1.0 [path] - path 1.8.3 - plugin_platform_interface 2.1.6 [meta] - pool 1.5.1 [async stack_trace] - pub_semver 2.1.4 [collection meta] - pubspec_parse 1.2.3 [checked_yaml collection json_annotation pub_semver yaml] - 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.4.0 [analyzer async build dart_style glob path source_span yaml] - source_helper 1.3.4 [analyzer collection source_gen] - source_span 1.10.0 [collection path term_glyph] - stack_trace 1.11.0 [path] - stream_channel 2.1.1 [async] - stream_transform 2.1.0 - string_scanner 1.2.0 [source_span] - term_glyph 1.2.1 - test_api 0.6.0 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - timing 1.0.1 [json_annotation] - typed_data 1.3.2 [collection] - vector_math 2.1.4 - watcher 1.1.0 [async path] - web 0.1.4-beta - web_socket_channel 2.4.0 [async crypto stream_channel] - yaml 3.1.2 [collection source_span string_scanner] ```

augusto-nc commented 11 months ago

Oi! You're from Brazil, right? https://status.firebase.google.com/incidents/RBfKSpJv7gCtb9NqqWh2

darshankawar commented 11 months ago

@ViniciusMacedoCamara

The odd it's that only occurs on Android Emulator devices, tested from the API Level 30 to the latest. On a Android physical device and iOS both physical and simulator works fine.

This most probably indicates it may not be a plugin side issue, but could be server issue and also due to an outage as shared above. I suggest you to reach out to Firebase support for further resolution.

ViniciusMacedoCamara commented 11 months ago

Hi all, the status was updated right after this was opened. As the status said, multiple ISP are being blocked and yes @darshankawar it is more of a server issue, now both emulator and physical devices are blocked.

IDK if we still have this open or close since is not a plugin issue, I want some thoughts on that. Cheers.

rrmcsd commented 11 months ago

image

The firebase server related to requests to the realtime database has been having problems since the day reported... It's been a week and nothing has resolved the problem. The firebase status still points out the bug on the platform.

darshankawar commented 11 months ago

I think the firebase support will be able to give you exact status on the current situation, so would be good to raise this in their bucket. https://firebase.google.com/support

ViniciusMacedoCamara commented 11 months ago

We can close this

leandermaguetas commented 11 months ago

Was the problem solved?

ViniciusMacedoCamara commented 11 months ago

Was the problem solved?

Yes, the problem was the server, Realtime Database services was down for like 3 to 4 business day for some ISP in Brazil only.

rrmcsd commented 11 months ago

RealtimeDatabase issue not yet resolved via Firabase status page. But the requests seem to be responding again and the front of the tree is loading.

https://status.firebase.google.com/