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

[firebase_auth]: flutter web - hangs with exception for web #12907

Open inteist opened 3 weeks ago

inteist commented 3 weeks ago

Is there an existing issue for this?

Which plugins are affected?

Auth

Which platforms are affected?

Web

Description

In a flutter project using FIrebase Auth, the web doesn't work.

It fails with the following stack trace

<closure> (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_auth_web-5.12.0/lib/src/interop/auth.dart:376)
<asynchronous gap> (Unknown Source:0)
onWaitInitState (LOCAL_PATH.pub-cache/hosted/pub.dev/firebase_auth_web-5.12.0/lib/src/interop/auth.dart:382)
onWaitInitState (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_auth_web-5.12.0/lib/src/interop/auth.dart:372)
<closure> (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_auth_web-5.12.0/lib/firebase_auth_web.dart:117)
<closure> (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_auth_web-5.12.0/lib/firebase_auth_web.dart:90)
<closure> (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/lib/src/firebase_core_web.dart:337)
initializeApp (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/lib/src/firebase_core_web.dart:329)
<asynchronous gap> (Unknown Source:0)
<closure> (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/lib/src/firebase_core_web.dart:167)
<asynchronous gap> (Unknown Source:0)
injectSrcScript (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/lib/src/firebase_core_web.dart:162)
injectSrcScript (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/lib/src/firebase_core_web.dart:110)
<closure> (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/lib/src/firebase_core_web.dart:192)
_initializeCore (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/lib/src/firebase_core_web.dart:186)
_initializeCore (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/lib/src/firebase_core_web.dart:176)
initializeApp (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/lib/src/firebase_core_web.dart:218)
initializeApp (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/lib/src/firebase_core_web.dart:214)
initializeApp (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core-2.32.0/lib/src/firebase.dart:43)
initializeApp (/LOCAL_PATH/.pub-cache/hosted/pub.dev/firebase_core-2.32.0/lib/src/firebase.dart:39)

for this code:

  /// On web we need to wait for the first onAuthStateChanged event to fire
  /// in order to be sure that the currentUser is set.
  /// To preserve behavior on web and mobile we store the initial user
  /// in `_initUser` and add it manually to the `_changeController`.
  Future<void> onWaitInitState() async {
    final completer = Completer();
    final nextWrapper = (auth_interop.UserJsImpl? user) {
      _initUser = User.getInstance(user);
      completer.complete();   
    };

the call stack stops on: completer.complete();

everything works fine on Android and iOS, but I can't start/view/test the web app

Reproducing the issue

I am not sure where exactly the issue is

Firebase Core version

2.32.0

Flutter Version

3.22.1

Relevant Log Output

No response

Flutter dependencies

Expand Flutter dependencies snippet
```yaml dependencies: - auto_size_text 3.0.0 [flutter] - carousel_slider 4.2.1 [flutter] - cherry_toast 1.10.1 [flutter] - circular_countdown_timer 0.2.3 [flutter] - clock 1.1.1 - cloud_firestore 4.17.5 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - connectivity_plus 6.0.3 [flutter flutter_web_plugins connectivity_plus_platform_interface web meta nm collection] - contained_tab_bar_view 0.8.0 [flutter container_tab_indicator] - crypto 3.0.3 [typed_data] - curved_labeled_navigation_bar 2.0.2 [flutter meta] - curved_navigation_bar 1.0.4 [flutter meta] - dart_mappable 4.2.2 [collection meta type_plus] - dartx 1.2.0 [characters collection crypto meta path time] - data_table_2 2.5.12 [flutter async] - day_night_time_picker 1.3.1 [flutter] - device_info_plus 10.1.0 [device_info_plus_platform_interface ffi file flutter flutter_web_plugins meta web win32 win32_registry] - dio 5.4.3+1 [async http_parser meta path] - firebase_analytics 10.10.7 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter] - firebase_auth 4.20.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 2.32.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 3.5.7 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_database 10.5.7 [firebase_core firebase_core_platform_interface firebase_database_platform_interface firebase_database_web flutter] - firebase_ui_auth 1.14.0 [email_validator firebase_auth firebase_core firebase_dynamic_links firebase_ui_localizations firebase_ui_oauth firebase_ui_shared flutter flutter_localizations meta] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine] - flutter_email_sender 6.0.3 [flutter] - flutter_form_builder 9.3.0 [flutter intl] - flutter_launcher_icons 0.13.1 [args checked_yaml cli_util image json_annotation path yaml] - flutter_local_notifications 17.1.2 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone] - flutter_native_splash 2.4.0 [args flutter flutter_web_plugins html image meta path universal_io xml yaml ansicolor] - flutter_ringtone_player 4.0.0+3 [flutter path_provider plugin_platform_interface] - flutter_secure_storage 9.2.2 [flutter flutter_secure_storage_linux flutter_secure_storage_macos flutter_secure_storage_platform_interface flutter_secure_storage_web flutter_secure_storage_windows meta] - flutter_sequence_animation 4.0.0 [flutter meta] - flutter_svg 2.0.10+1 [flutter http vector_graphics vector_graphics_codec vector_graphics_compiler] - flutter_timezone 1.0.8 [flutter_web_plugins flutter js] - fluttertoast 8.2.6 [flutter flutter_web_plugins web] - form_builder_validators 10.0.1 [flutter flutter_localizations intl] - gap 3.0.1 [flutter] - google_fonts 6.2.1 [flutter http path_provider crypto] - google_sign_in 6.2.1 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web] - graphview 1.2.0 [flutter collection] - intl 0.19.0 [clock meta path] - isoweek 1.1.4 [equatable] - jiffy 6.3.1 [intl] - loading_animation_widget 1.2.1 [flutter] - locale_plus 1.6.0 [flutter intl plugin_platform_interface universal_io] - logger 2.3.0 - package_info_plus 8.0.0 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface web win32 clock] - path 1.9.0 - path_provider 2.1.3 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows] - percent_indicator 4.2.3 [flutter] - searchfield 1.0.4 [flutter] - shared_preferences 2.2.3 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - shimmer 3.0.0 [flutter] - simple_animations 5.0.2 [flutter collection] - simple_gesture_detector 0.2.1 [flutter] - social_login_buttons 1.0.7 [flutter] - soundpool 2.4.1 [flutter soundpool_platform_interface soundpool_web soundpool_macos] - stacked 3.4.2 [flutter get_it meta provider collection stacked_shared universal_io path] - stacked_services 1.5.0 [flutter stacked_shared stacked get crypto] - timezone 0.9.3 [path] - uuid 4.4.0 [crypto sprintf meta fixnum] dev dependencies: - build_runner 2.4.10 [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] - dart_mappable_builder 4.2.3 [analyzer ansicolor build collection dart_mappable dart_style glob path source_gen] - firebase_database_mocks 0.6.1 [flutter flutter_test firebase_database mockito firebase_core_platform_interface] - flutter_lints 4.0.0 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service] - google_sign_in_mocks 0.3.0 [flutter google_sign_in] - import_sorter 4.6.0 [args tint yaml] - mockito 5.4.4 [analyzer build code_builder collection dart_style matcher meta path source_gen test_api] - stacked_generator 1.6.1-pre.1 [build path recase source_gen meta logger stacked_shared analyzer dart_style code_builder collection freezed_annotation json_annotation xdg_directories] transitive dependencies: - _fe_analyzer_shared 67.0.0 [meta] - _flutterfire_internals 1.3.35 [collection firebase_core firebase_core_platform_interface flutter meta] - analyzer 6.4.1 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - ansicolor 2.0.2 - archive 3.6.1 [crypto path] - args 2.5.0 - 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.2 [built_collection built_value crypto http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 2.4.2 [analyzer async build collection convert crypto graphs logging package_config path pool pub_semver stream_transform yaml] - build_runner_core 7.3.0 [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.9.2 [built_collection collection fixnum meta] - characters 1.3.0 - checked_yaml 2.0.3 [json_annotation source_span yaml] - cli_util 0.4.1 [meta path] - cloud_firestore_platform_interface 6.2.5 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 3.12.5 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins] - code_builder 4.10.0 [built_collection built_value collection matcher meta] - collection 1.18.0 - connectivity_plus_platform_interface 2.0.0 [flutter meta plugin_platform_interface] - container_tab_indicator 0.3.0 [flutter] - convert 3.1.1 [typed_data] - csslib 1.0.0 [source_span] - dart_style 2.3.6 [analyzer args collection path pub_semver source_span] - dbus 0.7.10 [args ffi meta xml] - desktop_webview_auth 0.0.15 [crypto flutter http flutter_web_plugins plugin_platform_interface] - device_info_plus_platform_interface 7.0.0 [flutter meta plugin_platform_interface] - email_validator 2.1.17 - equatable 2.0.5 [collection meta] - fake_async 1.3.1 [clock collection] - ffi 2.1.2 - file 7.0.0 [meta path] - firebase_analytics_platform_interface 3.10.8 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.5.7+7 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins] - firebase_auth_platform_interface 7.3.0 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.12.0 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web] - firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.17.1 [firebase_core_platform_interface flutter flutter_web_plugins meta web] - firebase_crashlytics_platform_interface 3.6.35 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_database_platform_interface 0.2.5+35 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_database_web 0.2.5+7 [firebase_core firebase_core_web firebase_database_platform_interface flutter flutter_web_plugins] - firebase_dynamic_links 5.5.7 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface] - firebase_dynamic_links_platform_interface 0.2.6+35 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_ui_localizations 1.11.0 [flutter flutter_localizations path] - firebase_ui_oauth 1.5.2 [desktop_webview_auth firebase_auth firebase_ui_auth firebase_ui_shared flutter_svg flutter] - firebase_ui_shared 1.4.1 [flutter] - fixnum 1.1.0 - flutter_local_notifications_linux 4.0.0+1 [dbus ffi flutter flutter_local_notifications_platform_interface path xdg_directories] - flutter_local_notifications_platform_interface 7.1.0 [flutter plugin_platform_interface] - flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math] - flutter_secure_storage_linux 1.2.1 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_macos 3.1.2 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_platform_interface 1.1.2 [flutter plugin_platform_interface] - flutter_secure_storage_web 1.2.1 [flutter flutter_secure_storage_platform_interface flutter_web_plugins js] - flutter_secure_storage_windows 3.1.2 [ffi flutter flutter_secure_storage_platform_interface path path_provider win32] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math] - freezed_annotation 2.4.1 [collection json_annotation meta] - frontend_server_client 4.0.0 [async path] - get 4.6.6 [flutter] - get_it 7.7.0 [async collection meta] - glob 2.1.2 [async collection file path string_scanner] - google_identity_services_web 0.3.1+1 [meta web] - google_sign_in_android 6.1.24 [flutter google_sign_in_platform_interface] - google_sign_in_ios 5.7.6 [flutter google_sign_in_platform_interface] - google_sign_in_platform_interface 2.4.5 [flutter plugin_platform_interface] - google_sign_in_web 0.12.4 [flutter flutter_web_plugins google_identity_services_web google_sign_in_platform_interface http web] - graphs 2.3.1 [collection] - html 0.15.4 [csslib source_span] - http 1.2.1 [async http_parser meta web] - http_multi_server 3.2.1 [async] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - image 4.2.0 [archive meta xml] - io 1.0.4 [meta path string_scanner] - js 0.6.7 [meta] - json_annotation 4.9.0 [meta] - leak_tracker 10.0.4 [clock collection meta path vm_service] - leak_tracker_flutter_testing 3.0.3 [flutter leak_tracker leak_tracker_testing matcher meta] - leak_tracker_testing 3.0.1 [leak_tracker matcher meta] - lints 4.0.0 - logging 1.2.0 - matcher 0.12.16+1 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.8.0 [collection] - meta 1.12.0 - mime 1.0.5 - nested 1.0.0 [flutter] - nm 0.5.0 [dbus] - package_config 2.1.0 [path] - package_info_plus_platform_interface 3.0.0 [flutter meta plugin_platform_interface] - path_parsing 1.0.1 [vector_math meta] - path_provider_android 2.2.5 [flutter path_provider_platform_interface] - path_provider_foundation 2.4.0 [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.2 [flutter platform plugin_platform_interface] - path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32] - petitparser 6.0.2 [meta] - platform 3.1.4 - plugin_platform_interface 2.1.8 [meta] - pool 1.5.1 [async stack_trace] - provider 6.1.2 [collection flutter nested] - pub_semver 2.1.4 [collection meta] - pubspec_parse 1.3.0 [checked_yaml collection json_annotation pub_semver yaml] - recase 4.1.0 - shared_preferences_android 2.2.3 [flutter shared_preferences_platform_interface] - shared_preferences_foundation 2.4.0 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.3.2 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_platform_interface 2.3.2 [flutter plugin_platform_interface] - shared_preferences_web 2.3.0 [flutter flutter_web_plugins shared_preferences_platform_interface web] - shared_preferences_windows 2.3.2 [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 2.0.0 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - soundpool_macos 2.3.0 [flutter soundpool_platform_interface] - soundpool_platform_interface 2.2.0 [flutter meta plugin_platform_interface] - soundpool_web 2.3.0 [flutter flutter_web_plugins soundpool_platform_interface http] - source_gen 1.5.0 [analyzer async build dart_style glob path source_span yaml] - source_span 1.10.0 [collection path term_glyph] - sprintf 7.0.0 - stack_trace 1.11.1 [path] - stacked_shared 1.4.0 [get_it] - stream_channel 2.1.2 [async] - stream_transform 2.1.0 - string_scanner 1.2.0 [source_span] - term_glyph 1.2.1 - test_api 0.7.0 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - time 2.1.4 [clock] - timing 1.0.1 [json_annotation] - tint 2.0.1 - type_plus 2.1.1 - typed_data 1.3.2 [collection] - universal_io 2.2.2 [collection meta typed_data] - vector_graphics 1.1.11+1 [flutter http vector_graphics_codec] - vector_graphics_codec 1.1.11+1 - vector_graphics_compiler 1.1.11+1 [args meta path_parsing xml vector_graphics_codec path] - vector_math 2.1.4 - vm_service 14.2.1 - watcher 1.1.0 [async path] - web 0.5.1 - web_socket 0.1.5 [web] - web_socket_channel 3.0.0 [async crypto stream_channel web web_socket] - win32 5.5.1 [ffi] - win32_registry 1.1.3 [ffi win32] - xdg_directories 1.0.4 [meta path] - xml 6.5.0 [collection meta petitparser] - yaml 3.1.2 [collection source_span string_scanner] ```

Additional context and comments

No response

TarekkMA commented 3 weeks ago

@inteist Thank you for reporting this issue. Can you please try and see if the example app would result in a similar issues

dpss77 commented 2 weeks ago

I have tested with the provided "example app" and encountered a similar issue. Specifically, on the profile page, I attempt to request a Firebase document, but the request fails. Please note that AppCheck is enabled on the Firebase database with read access.

Here is the code I tried to add in the example app:

try { FirebaseFirestore.instance.collection('acollection').doc(user.uid).get().then((value) { if (value.exists) { final data = value.data()!; log(data.toString()); } }); } catch (e) { log(e.toString()); } Would appreciate any guidance on resolving this issue. Thank you!

google-oss-bot commented 3 days ago

Hey @inteist. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!