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.74k stars 3.98k forks source link

🐛 [firestore_web] No option for experimentalForceLongPolling with last v9 js sdk wrapping #9478

Closed jomiplaz closed 2 years ago

jomiplaz commented 2 years ago

Bug report

I am having errors in the latest version of firestore with iphone in the web version, it seems to be a problem of the sdk itself: https://github.com/firebase/firebase-js-sdk/issues/6118

To solve this, I want to access to windows.firebase or similar to activate experimentalForceLongPolling in firestore but with the last v9 js sdk wrapping I don't have access, similar to this:

  <script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js"></script>
  <script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-firestore.js"></script>
  <script>
    // Initialize Firebase
    firebase.initializeApp({ ... });

    firebase.firestore().settings({ experimentalForceLongPolling: true })
  </script>

How can I do it? Because I have tried in many ways and I have not succeeded, thanks.

Flutter dependencies

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

Click To Expand ``` Dart SDK 2.18.0 Flutter SDK 3.3.0 dependencies: - anitex 3.0.1 [flutter] - archive 3.3.0 [crypto path] - auto_animated 3.1.0 [flutter visibility_detector] - badges 2.0.3 [flutter] - carousel_slider 4.1.1 [flutter] - collection 1.16.0 - custom_sliding_segmented_control 1.7.1 [flutter] - date_time_picker 2.1.0 [flutter intl] - easy_localization 3.0.1 [flutter shared_preferences intl args path easy_logger flutter_localizations] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine] - flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math] - get 4.6.5 [flutter] - google_fonts 3.0.1 [flutter http path_provider crypto] - hive 2.2.3 [meta crypto] - hive_flutter 1.1.0 [flutter hive path_provider path] - horizontal_data_table 4.1.2+2 [flutter provider] - marquee 2.2.3 [fading_edge_scrollview flutter] - pluto_grid 5.0.6 [flutter intl rxdart collection] - sentry_flutter 6.9.1 [flutter flutter_web_plugins sentry package_info_plus meta] - socage_core 4.0.0 [flutter flutter_localizations get easy_localization sentry_flutter new_gradient_app_bar flutter_phoenix fluttertoast url_launcher expandable random_string flutter_spinkit auto_size_text video_player chewie quiver diacritic package_info_plus week_of_year pluto_grid ai_barcode collection async http uuid crypto shared_preferences badges retry google_fonts universal_html excel image_picker extended_image file_picker hand_signature firebase_core firebase_auth cloud_functions cloud_firestore firebase_storage pdf barcode printing syncfusion_flutter_pdfviewer syncfusion_flutter_datepicker hive hive_flutter queue] - step_progress_indicator 1.0.2 [flutter] - table_calendar 3.0.6 [flutter intl simple_gesture_detector] - url_strategy 0.2.0 [flutter_web_plugins] 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_driver 0.0.0 [file flutter flutter_test fuchsia_remote_debug_protocol path meta vm_service webdriver archive async boolean_selector characters clock collection crypto matcher material_color_utilities platform process source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math] - flutter_launcher_icons 0.10.0 [args checked_yaml cli_util image json_annotation path 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 collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph] - hive_generator 1.1.3 [build source_gen hive analyzer source_helper] - integration_test 0.0.0 [flutter flutter_driver flutter_test path vm_service archive async boolean_selector characters clock collection crypto fake_async file matcher material_color_utilities meta source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math webdriver] transitive dependencies: - _fe_analyzer_shared 47.0.0 [meta] - ai_barcode 3.2.4 [flutter ai_barcode_platform_interface ai_barcode_web] - ai_barcode_platform_interface 3.0.1 [flutter] - ai_barcode_web 3.0.1 [flutter flutter_web_plugins ai_barcode_platform_interface qr_flutter universal_html] - analyzer 4.7.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - args 2.3.1 - async 2.9.0 [collection meta] - auto_size_text 3.0.0 [flutter] - barcode 2.1.0 [meta qr] - 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.1 [built_collection collection fixnum meta] - characters 1.2.1 - 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] - cli_util 0.3.5 [meta path] - clock 1.1.1 - cloud_firestore 3.4.6 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cloud_firestore_platform_interface 5.7.3 [collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 2.8.6 [cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - cloud_functions 3.3.6 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter] - cloud_functions_platform_interface 5.1.15 [firebase_core flutter meta plugin_platform_interface] - cloud_functions_web 4.3.4 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - code_builder 4.2.0 [built_collection built_value collection matcher meta] - convert 3.0.2 [typed_data] - cross_file 0.3.3+1 [js meta] - crypto 3.0.2 [typed_data] - csslib 0.17.2 [source_span] - cupertino_icons 1.0.5 - dart_style 2.2.3 [analyzer args path pub_semver source_span] - diacritic 0.1.3 - easy_logger 0.0.2 [flutter] - equatable 2.0.5 [collection meta] - excel 2.0.0-null-safety-3 [archive xml equatable] - expandable 5.0.1 [flutter] - extended_image 6.3.0 [extended_image_library flutter meta] - extended_image_library 3.4.0 [crypto flutter http_client_helper path path_provider] - fading_edge_scrollview 3.0.0 [flutter] - fake_async 1.3.1 [clock collection] - ffi 1.2.1 - file 6.1.2 [meta path] - file_picker 4.6.1 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32] - firebase_auth 3.7.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_auth_platform_interface 6.6.0 [collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 4.3.0 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta] - firebase_core 1.21.1 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_core_platform_interface 4.5.1 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 1.7.2 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_storage 10.3.7 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - firebase_storage_platform_interface 4.1.15 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.3.5 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta] - fixnum 1.0.1 - flutter_phoenix 1.1.0 [flutter] - flutter_plugin_android_lifecycle 2.0.7 [flutter] - flutter_spinkit 5.1.0 [flutter] - flutter_svg 0.23.0+1 [flutter meta path_drawing vector_math xml] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - fluttertoast 8.0.9 [flutter flutter_web_plugins] - frontend_server_client 2.1.3 [async path] - fuchsia_remote_debug_protocol 0.0.0 [process vm_service file meta path platform] - glob 2.1.0 [async collection file path string_scanner] - graphs 2.1.0 [collection] - hand_signature 2.1.1 [flutter flutter_svg] - html 0.15.0 [csslib source_span] - http 0.13.5 [async http_parser meta path] - http_client_helper 2.0.3 [http] - http_multi_server 3.2.1 [async] - http_parser 4.0.1 [collection source_span string_scanner typed_data] - image 3.1.3 [archive meta xml] - image_picker 0.8.5+3 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_platform_interface] - image_picker_android 0.8.5+2 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface] - image_picker_for_web 2.1.8 [flutter flutter_web_plugins image_picker_platform_interface] - image_picker_ios 0.8.6 [flutter image_picker_platform_interface] - image_picker_platform_interface 2.6.1 [cross_file flutter http plugin_platform_interface] - intl 0.17.0 [clock path] - io 1.0.3 [meta path string_scanner] - js 0.6.4 - json_annotation 4.6.0 [meta] - lints 2.0.0 - logging 1.0.2 - matcher 0.12.12 [stack_trace] - material_color_utilities 0.1.5 - meta 1.8.0 - mime 1.0.2 - nested 1.0.0 [flutter] - new_gradient_app_bar 0.2.0 [flutter] - package_config 2.1.0 [path] - package_info_plus 1.4.2 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web] - package_info_plus_linux 1.0.5 [package_info_plus_platform_interface flutter path] - package_info_plus_macos 1.3.0 [flutter] - package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface] - package_info_plus_web 1.0.5 [flutter flutter_web_plugins http meta package_info_plus_platform_interface] - package_info_plus_windows 1.0.5 [package_info_plus_platform_interface ffi flutter win32] - path 1.8.2 - path_drawing 0.5.1+1 [vector_math meta path_parsing flutter] - path_parsing 0.2.1 [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.20 [flutter path_provider_platform_interface] - path_provider_ios 2.0.11 [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] - pdf 3.6.4 [archive barcode crypto image meta path_parsing vector_math xml] - petitparser 5.0.0 [meta] - platform 3.1.0 - plugin_platform_interface 2.1.2 [meta] - pool 1.5.1 [async stack_trace] - printing 5.6.5 [ffi flutter flutter_web_plugins http image js meta pdf plugin_platform_interface] - process 4.2.4 [file path platform] - provider 6.0.3 [collection flutter nested] - pub_semver 2.1.1 [collection meta] - pubspec_parse 1.2.1 [checked_yaml collection json_annotation pub_semver yaml] - qr 2.1.0 [meta] - qr_flutter 4.0.0 [flutter qr] - queue 3.1.0+1 - quiver 3.1.0 [matcher] - random_string 2.3.1 - retry 3.1.0 - rxdart 0.27.5 - sentry 6.9.1 [http meta stack_trace uuid] - shared_preferences 2.0.15 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - shared_preferences_android 2.0.12 [flutter shared_preferences_platform_interface] - shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface] - shared_preferences_platform_interface 2.1.0 [flutter plugin_platform_interface] - shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface] - shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - shelf 1.3.2 [async collection http_parser path stack_trace stream_channel] - shelf_web_socket 1.0.2 [shelf stream_channel web_socket_channel] - simple_gesture_detector 0.2.0 [flutter] - 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.9.0 [collection path term_glyph] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - stream_transform 2.0.0 - string_scanner 1.1.1 [source_span] - sync_http 0.3.1 - syncfusion_flutter_core 20.2.46 [vector_math flutter] - syncfusion_flutter_datepicker 20.2.46 [flutter intl syncfusion_flutter_core] - syncfusion_flutter_pdf 20.2.46 [flutter intl xml syncfusion_flutter_core crypto convert] - syncfusion_flutter_pdfviewer 20.2.46-beta [flutter vector_math async http uuid intl syncfusion_pdfviewer_platform_interface syncfusion_pdfviewer_web syncfusion_pdfviewer_macos syncfusion_pdfviewer_windows syncfusion_flutter_core syncfusion_flutter_pdf url_launcher] - syncfusion_pdfviewer_macos 20.2.46-beta [flutter syncfusion_pdfviewer_platform_interface] - syncfusion_pdfviewer_platform_interface 20.2.46-beta [flutter plugin_platform_interface] - syncfusion_pdfviewer_web 20.2.46-beta [flutter flutter_web_plugins js meta syncfusion_pdfviewer_platform_interface] - syncfusion_pdfviewer_windows 20.2.46-beta [flutter] - term_glyph 1.2.1 - test_api 0.4.12 [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] - universal_html 2.0.8 [async csslib charcode collection html meta source_span typed_data universal_io] - universal_io 2.0.4 [collection crypto meta typed_data] - 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] - 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.13 [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.7 [flutter html video_player_android video_player_avfoundation video_player_platform_interface video_player_web] - video_player_android 2.3.9 [flutter video_player_platform_interface] - video_player_avfoundation 2.3.5 [flutter video_player_platform_interface] - video_player_platform_interface 5.1.4 [flutter plugin_platform_interface] - video_player_web 2.0.12 [flutter flutter_web_plugins video_player_platform_interface] - visibility_detector 0.3.3 [flutter] - vm_service 9.0.0 - 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] - webdriver 3.0.0 [archive matcher path stack_trace sync_http] - week_of_year 2.0.0 - win32 2.6.1 [ffi] - xdg_directories 0.2.0+2 [meta path process] - xml 5.4.1 [collection meta petitparser] - yaml 3.1.1 [collection source_span string_scanner] ```

darshankawar commented 2 years ago

To solve this, I want to access to windows.firebase or similar to activate experimentalForceLongPolling in firestore but with the last v9 js sdk wrapping I don't have access, similar to this:

Do you mean, with latest v9, you are unable to use firebase.firestore().settings({ experimentalForceLongPolling: true }) in index.html, but with previous version, like, 8.6.1, you were able to ?

Also, check this issue comment for your reference and see if it helps.

jomiplaz commented 2 years ago

Hi, with the automatically inject Firebase JS SDKs it is not possible to configure in this way, that's my problem.

I really have the problem in v9 of the js-sdk with iPhone (the app crashes with many firestore reads), but the error is already confirmed as belonging to the sdk.

darshankawar commented 2 years ago

Thanks for clarifying. I suggest you to follow-up in the original issue, as it seems to belong to native sdk and not at client side, because flutterfire plugins are wrappers around native firebase sdks and also the fact that, at client side (flutterfire), there are no experimental services implemented.

Closing from here. If you disagree, write in comments and I'll reopen it.