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_auth] TypeError when submitting phone number for phone auth #9141

Closed SavvyBud closed 2 years ago

SavvyBud commented 2 years ago

Bug report

Describe the bug For the flutter web application, when the RecaptchaVerifier is created following error is seen:

Error: TypeError: Cannot read properties of undefined (reading 'settings')
https://www.gstatic.com/firebasejs/9.9.0/firebase-auth.js 8390:43                        new RecaptchaVerifier

The flutter application is using the following combination of libraries:

firebase_core: ^1.18.0 firebase_auth: ^3.3.20 firebase_auth_web: ^4.0.0

Steps to reproduce

Steps to reproduce the behavior: When the user enters a phone number on the login screen for the app, call the following function:

Future<void> _submitPhoneNumber(String _phoneNumber) async {
    debugPrint('LoginPage._submitPhoneNumber: $_phoneNumber');
    final _auth = FirebaseAuth.instance;
    _auth.setPersistence(Persistence.LOCAL);

    try {
      RecaptchaVerifier recaptchaVerifier = RecaptchaVerifier(
        onSuccess: () {
          debugPrint("reCAPTCHA success");
        },
        onError: (FirebaseAuthException error) =>
            debugPrint("RecaptchaVerifier onError called: $error"),
        onExpired: () => debugPrint('reCAPTCHA Expired!'),
      );
      debugPrint('LoginPage._submitPhoneNumber - created RecaptchaVerifier');
      confirmationResult =
          await _auth.signInWithPhoneNumber(_phoneNumber, recaptchaVerifier);
      debugPrint("got back from signInWithPhoneNumber:");
      // smsCodeDialog(context, _phoneNumber, confirmationResult);
    } catch (e, s) {
      debugPrint("Error: ${e.toString()}");
      debugPrintStack(stackTrace: s);
      //final snackBar = SnackBar(content: Text(e.toString()));
      //ScaffoldMessenger.of(context).showSnackBar(snackBar);
    }
  }

Expected behavior

The Recapta functionality should work.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` Doctor summary (to see all details, run flutter doctor -v): [βœ“] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-x64, locale en) [βœ“] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [βœ“] Xcode - develop for iOS and macOS (Xcode 13.4.1) [βœ“] Chrome - develop for the web [βœ“] Android Studio (version 2021.2) [βœ“] IntelliJ IDEA Community Edition (version 2020.3.2) [βœ“] VS Code (version 1.69.1) [βœ“] Connected device (2 available) ! Error: iPhone is not connected. Xcode will continue when iPhone is connected. (code -13) [βœ“] HTTP Host Availability ```

Flutter dependencies

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

Click To Expand ``` Dart SDK 2.17.6 Flutter SDK 3.0.5 kosha 1.0.0+1 dependencies: - cloud_firestore 3.3.0 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cloud_functions 3.3.2 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter] - converter 0.3.4 [equatable invertible] - crypto 3.0.2 [typed_data] - cupertino_icons 1.0.5 - excel 2.0.0-null-safety-3 [archive xml equatable] - file_picker 4.6.1 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32] - firebase_analytics 9.2.0 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter] - firebase_auth 3.4.2 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_auth_web 4.0.0 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta] - firebase_core 1.19.2 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_remote_config 2.0.12 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter] - firebase_storage 10.3.2 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine] - flutter_widget_from_html 0.8.5 [flutter flutter_widget_from_html_core fwfh_cached_network_image fwfh_chewie fwfh_just_audio fwfh_selectable_text fwfh_svg fwfh_url_launcher fwfh_webview html] - im_stepper 1.0.1+1 [flutter] - intl 0.17.0 [clock path] - json_annotation 4.6.0 [meta] - mime 1.0.2 - motion_toast 2.2.3 [flutter] - provider 6.0.3 [collection flutter nested] - url_launcher 6.1.5 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] dev dependencies: - build_runner 2.2.0 [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] - flutter_lints 2.0.1 [lints] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph] - json_serializable 6.3.1 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper] transitive dependencies: - _fe_analyzer_shared 41.0.0 [meta] - analyzer 4.2.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - archive 3.3.0 [crypto path] - args 2.3.1 - async 2.8.2 [collection meta] - audio_session 0.1.10 [flutter flutter_web_plugins rxdart meta] - boolean_selector 2.1.0 [source_span string_scanner] - build 2.3.0 [analyzer async convert crypto glob logging meta path] - build_config 1.1.0 [checked_yaml json_annotation path pubspec_parse yaml] - build_daemon 3.1.0 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 2.0.9 [analyzer async build crypto graphs logging path package_config pool pub_semver stream_transform yaml] - build_runner_core 7.2.3 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pool timing watcher yaml] - built_collection 5.1.1 - built_value 8.4.0 [built_collection collection fixnum meta] - cached_network_image 3.2.1 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web] - cached_network_image_platform_interface 1.0.0 [flutter flutter_cache_manager] - cached_network_image_web 1.0.1 [flutter flutter_cache_manager cached_network_image_platform_interface] - characters 1.2.0 - charcode 1.3.1 - checked_yaml 2.0.1 [json_annotation source_span yaml] - chewie 1.3.4 [cupertino_icons flutter provider video_player wakelock] - clock 1.1.0 - cloud_firestore_platform_interface 5.6.0 [collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 2.7.0 [cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - cloud_functions_platform_interface 5.1.11 [firebase_core flutter meta plugin_platform_interface] - cloud_functions_web 4.3.0 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - code_builder 4.1.0 [built_collection built_value collection matcher meta] - collection 1.16.0 - convert 3.0.2 [typed_data] - csslib 0.17.2 [source_span] - dart_style 2.2.3 [analyzer args path pub_semver source_span] - equatable 2.0.3 [collection meta] - fake_async 1.3.0 [clock collection] - ffi 1.2.1 - file 6.1.2 [meta path] - firebase_analytics_platform_interface 3.2.0 [firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.4.1 [firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - firebase_auth_platform_interface 6.3.2 [firebase_core flutter meta plugin_platform_interface] - firebase_core_platform_interface 4.4.3 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 1.7.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_remote_config_platform_interface 1.1.11 [firebase_core flutter meta plugin_platform_interface] - firebase_remote_config_web 1.1.0 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins js] - firebase_storage_platform_interface 4.1.11 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.3.0 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta] - fixnum 1.0.1 - flutter_blurhash 0.7.0 [flutter] - flutter_cache_manager 3.3.0 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid] - flutter_plugin_android_lifecycle 2.0.7 [flutter] - flutter_svg 1.0.3 [flutter meta path_drawing vector_math xml] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - flutter_widget_from_html_core 0.8.5+3 [csslib flutter fwfh_text_style html] - frontend_server_client 2.1.3 [async path] - fwfh_cached_network_image 0.7.0+2 [cached_network_image flutter flutter_cache_manager flutter_widget_from_html_core] - fwfh_chewie 0.7.0+1 [chewie flutter flutter_widget_from_html_core video_player] - fwfh_just_audio 0.6.2+2 [flutter flutter_widget_from_html_core just_audio] - fwfh_selectable_text 0.8.3+1 [flutter flutter_widget_from_html_core] - fwfh_svg 0.7.2 [flutter flutter_svg flutter_widget_from_html_core] - fwfh_text_style 2.7.3+2 [flutter] - fwfh_url_launcher 0.6.1+3 [flutter flutter_widget_from_html_core url_launcher] - fwfh_webview 0.6.2+2 [flutter flutter_widget_from_html_core webview_flutter] - glob 2.1.0 [async collection file path string_scanner] - graphs 2.1.0 [collection] - html 0.15.0 [csslib source_span] - http 0.13.4 [async http_parser meta path] - http_multi_server 3.2.1 [async] - http_parser 4.0.1 [collection source_span string_scanner typed_data] - invertible 2.0.0 [equatable] - io 1.0.3 [meta path string_scanner] - js 0.6.4 - just_audio 0.9.28 [just_audio_platform_interface just_audio_web audio_session rxdart path path_provider async uuid crypto meta flutter] - just_audio_platform_interface 4.2.0 [flutter plugin_platform_interface] - just_audio_web 0.4.7 [just_audio_platform_interface flutter flutter_web_plugins] - lints 2.0.0 - logging 1.0.2 - matcher 0.12.11 [stack_trace] - material_color_utilities 0.1.4 - meta 1.7.0 - nested 1.0.0 [flutter] - octo_image 1.0.2 [flutter flutter_blurhash] - package_config 2.1.0 [path] - path 1.8.1 - path_drawing 1.0.0 [vector_math meta path_parsing flutter] - path_parsing 1.0.0 [vector_math meta] - path_provider 2.0.11 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows] - path_provider_android 2.0.16 [flutter path_provider_platform_interface] - path_provider_ios 2.0.10 [flutter path_provider_platform_interface] - path_provider_linux 2.1.7 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_macos 2.0.6 [flutter path_provider_platform_interface] - path_provider_platform_interface 2.0.4 [flutter platform plugin_platform_interface] - path_provider_windows 2.0.7 [ffi flutter path path_provider_platform_interface win32] - pedantic 1.11.1 - petitparser 5.0.0 [meta] - platform 3.1.0 - plugin_platform_interface 2.1.2 [meta] - pool 1.5.1 [async stack_trace] - process 4.2.4 [file path platform] - pub_semver 2.1.1 [collection meta] - pubspec_parse 1.2.0 [checked_yaml collection json_annotation pub_semver yaml] - rxdart 0.27.5 - shelf 1.3.1 [async collection http_parser path stack_trace stream_channel] - shelf_web_socket 1.0.2 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - source_gen 1.2.2 [analyzer async build dart_style glob meta path source_span yaml] - source_helper 1.3.2 [analyzer collection source_gen] - source_span 1.8.2 [collection path term_glyph] - sqflite 2.0.3 [flutter sqflite_common path] - sqflite_common 2.2.1+1 [synchronized path meta] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - stream_transform 2.0.0 - string_scanner 1.1.0 [charcode source_span] - synchronized 3.0.0+2 - term_glyph 1.2.0 - test_api 0.4.9 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - timing 1.0.0 [json_annotation] - typed_data 1.3.1 [collection] - url_launcher_android 6.0.17 [flutter url_launcher_platform_interface] - url_launcher_ios 6.0.17 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.1 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.1 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.1.0 [flutter plugin_platform_interface] - url_launcher_web 2.0.12 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.1 [flutter url_launcher_platform_interface] - uuid 3.0.6 [crypto] - vector_math 2.1.2 - video_player 2.4.5 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web] - video_player_android 2.3.7 [flutter video_player_platform_interface] - video_player_avfoundation 2.3.5 [flutter video_player_platform_interface] - video_player_platform_interface 5.1.3 [flutter plugin_platform_interface] - video_player_web 2.0.10 [flutter flutter_web_plugins video_player_platform_interface] - wakelock 0.6.2 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web wakelock_windows] - wakelock_macos 0.4.0 [flutter flutter_web_plugins wakelock_platform_interface] - wakelock_platform_interface 0.3.0 [flutter meta] - wakelock_web 0.4.0 [flutter flutter_web_plugins js wakelock_platform_interface] - wakelock_windows 0.2.0 [flutter wakelock_platform_interface win32] - watcher 1.0.1 [async path] - web_socket_channel 2.2.0 [async crypto stream_channel] - webview_flutter 3.0.4 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview] - webview_flutter_android 2.8.14 [flutter webview_flutter_platform_interface] - webview_flutter_platform_interface 1.9.1 [flutter meta plugin_platform_interface] - webview_flutter_wkwebview 2.9.1 [flutter path webview_flutter_platform_interface] - win32 2.6.1 [ffi] - xdg_directories 0.2.0+1 [meta path process] - xml 5.4.1 [collection meta petitparser] - yaml 3.1.1 [collection source_span string_scanner] ```

darshankawar commented 2 years ago

Closing this as duplicate of https://github.com/firebase/flutterfire/issues/9097