Closed pxsanghyo closed 3 years ago
Thanks for logging this with all the details @pxsanghyo
FlutterFire folks (if anyone is watching) this is clearly related to the PR I did to implement useEmulator in the first place but I haven't done any triage on this one other than to see what version of firebase-js-sdk was required for useEmulator to work on the web - and I think the version used here should work
So this is likely a bug, unfortunately, but I don't have any ideas what it would be except I've done Android and iOS a lot, but never flutter web stuff so I must have just done it incorrectly. If anyone with more web experience wants to have a look that would be fantastic.
Reproducible on the latest master 1.27.0-5.0.pre.94
with firebase_auth: ^0.20.1
and
<script src="https://www.gstatic.com/firebasejs/8.2.4/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.2.4/firebase-auth.js"></script>
It's worth mentioning that there is a more fundamental issue as well. As far as I understand the latest pinned JS SDK version that we test against is 7.20.0
(https://github.com/FirebaseExtended/flutterfire/issues/4127#issuecomment-771575645) and there are some other outstanding issues with using newer versions (like https://github.com/FirebaseExtended/flutterfire/issues/4127).
The version needed for useEmulator
is at least 8.2.4
https://firebase.google.com/support/release-notes/js#version_824_-_january_21_2021
Mmm - I forward-ported the ios/android code across their breaking changes releases (firebase-ios-sdk v6->v7 and firebase-android-sdk v25->v26) but it appears (based on #4127) that there is a similar forward port required for firebase-js-sdk v7->v8 - @markusaksli-nc is that fair to say?
That is separate from this issue where useEmulator should work if you've got nothing but app+auth included, but would entangle it yes.
For now I think it is safe to say that for web, firebase_auth::useEmulator will not be generally supportable for a while because of the SDK upgrade issue even if it did not have the bug mentioned here. Not sure what FlutterFire policy is on those sorts of things but a documentation update might be best in the interim. I've bolded the statement above for anyone that finds this while searching
Not sure but that might be the case.
As for the documentation, it should be added along with what was mentioned in the PR https://github.com/FirebaseExtended/flutterfire/issues/5102
@markusaksli-nc great point and thanks for linking that in. The insecure network changes are vital and perhaps unexpected to people not used to working directly on the native platforms.
1- I will make a docs PR for auth.useEmulator immediately that mentions a) web is not supported at the moment and b) android and ios need insecure transport 2- I will make a 2nd separate PR for firebase-js-sdk that mentions that only specific versions are tested, and proposes a bump to 8.0.1 (which appears to work per #4127) and using hosted URLs to get that specific version e.g. https://github.com/FirebaseExtended/flutterfire/issues/4127#issuecomment-771575645 to see what the rest of the FlutterFire maintainers think - would address #4422 3- I will make a 3rd separate PR which takes firebase-js-sdk all the way to current so as a group we can see what breaks and start fixing it purposefully
Note that nowhere in there is a PR to actually fix auth.useEmulator on web (apologies!) but the ideas above are quick structural things I can do to help move this forward (and avoid developer surprise today, whereas the actual fix here is something I can't reliably estimate since I was the source of error in the first place
+
Took me longer than I wished to get those PRs in, but they're all in now, hopefully firebase-js-sdk updates will see some progress based on them, and developers won't be frustrated by wasting time trying auth.useEmulator on web.
I'll see if I can fix the underlying issue now, may be possible now that I'm set up with correct SDKs etc
For all concerned, I was able to find the underlying error in my original web implementation of auth.useEmulator and repair it, PR posted at #5171
I'm always available for bug reports or PR feedback but in general have no control over review, merge, or release schedule here so I won't have any information or influence on that, sorry.
With the combination of firebase-js-sdk >= 8.0.1 and #5171 it will auth useEmulator will work on web though. (Careful if you go past firebase-js-sdk v8.0.1 you will hit #4127 if you use firestore...)
PR has been merged, but in changelog we can still see that emulator is not supported on WEB ?
Firebase Auth WEB 1.0.2 should have this fix, so why its not supported ?
@radvansky-tomas this commit indicates that it has been released https://github.com/FirebaseExtended/flutterfire/commit/e508917e72701812cf979360dd5f522d500e2ca8
Have you updated firebase-js-sdk to at least v8.0.0? (note that v8.0.2 is subject #4127 so might not work for you until that is conclusively fixed)
Oh - and to specifically answer the question: #4127 means it's hard to make a statement of official support for firebase-js-sdk v8 features yet, and this is a firebase-js-sdk v8 feature. Tread carefully and it will work though.
Bug report
Describe the bug
FirebaseAuth.instance.useEmulator('')
crashes on web.Steps to reproduce
Steps to reproduce the behavior:
FirebaseAuth.instance.useEmulator('')
flutter run -d chrome
Expected behavior
Should run on web as well. Android and iOS works fine.
Additional context
The error message on web:
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 beta, 1.26.0-17.6.pre, on macOS 11.2.1 20D74 darwin-x64, locale en) [β] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [β] Xcode - develop for iOS and macOS [β] Chrome - develop for the web [β] Android Studio [β] Android Studio (version 4.1) [β] Connected device (3 available) β’ No issues found! ```Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
``` Dart SDK 2.12.0-259.12.beta Flutter SDK 1.26.0-17.6.pre dependencies: - bloc 6.1.1 [meta] - cloud_firestore 0.16.0+1 [flutter meta quive r firebase_core firebase_core_platform_interfa ce cloud_firestore_platform_interface cloud_fi restore_web] - cupertino_icons 1.0.2 - dartz 0.9.2 - firebase_analytics 7.0.1 [meta flutter fireb ase_core firebase_analytics_web firebase_analy tics_platform_interface] - firebase_auth 0.20.1 [meta firebase_core fir ebase_core_platform_interface firebase_auth_pl atform_interface firebase_auth_web flutter] - firebase_core 0.7.0 [firebase_core_platform_ interface flutter quiver meta firebase_core_we b] - firebase_crashlytics 0.4.0+1 [flutter stack_ trace firebase_core firebase_core_platform_int erface firebase_crashlytics_platform_interface ] - firebase_dynamic_links 0.7.0+1 [flutter fire base_core] - firebase_performance 0.5.0+1 [flutter fireba se_core] - flutter 0.0.0 [characters collection meta ty ped_data vector_math sky_engine] - flutter_bloc 6.1.2 [flutter bloc provider] - flutter_platform_widgets 0.80.0-beta.0 [flut ter] - freezed_annotation 0.12.0 [collection json_a nnotation meta] - get_it 5.0.6 [async meta] - google_fonts 1.1.2 [flutter http path_provid er crypto] - hive 1.4.4+1 [meta crypto] - hive_flutter 0.3.1 [flutter hive path_provid er path] - injectable 1.1.0 [get_it] dev dependencies: - build_runner 1.11.1 [args async build build_ config build_daemon build_resolvers build_runn er_core code_builder collection crypto dart_st yle glob graphs http_multi_server io js loggin g meta mime path pedantic pool pub_semver pubs pec_parse shelf shelf_web_socket stack_trace s tream_transform timing watcher web_socket_chan nel yaml] - flutter_launcher_icons 0.9.0 [image args yam l path] - flutter_test 0.0.0 [flutter test_api path fa ke_async clock stack_trace vector_math async b oolean_selector characters charcode collection matcher meta source_span stream_channel strin g_scanner term_glyph typed_data] - freezed 0.12.7 [analyzer build build_config meta source_gen freezed_annotation] - injectable_generator 1.1.0 [build source_gen path glob analyzer meta code_builder dart_sty le injectable collection] - integration_test 0.9.2+2 [flutter flutter_dr iver flutter_test path vm_service archive args async boolean_selector characters charcode cl ock collection convert crypto fake_async file matcher meta source_span stack_trace stream_ch annel string_scanner sync_http term_glyph test _api typed_data vector_math webdriver] dependency overrides: - flutter_launcher_icons 0.9.0 [image args yam l path] transitive dependencies: - _fe_analyzer_shared 12.0.0 [meta] - analyzer 0.40.6 [_fe_analyzer_shared args cl i_util collection convert crypto glob meta pac kage_config path pub_semver source_span watche r yaml] - archive 2.0.13 [crypto args path] - args 1.6.0 - async 2.5.0 [collection] - boolean_selector 2.1.0 [source_span string_s canner] - build 1.6.2 [analyzer async convert crypto g lob logging meta path] - build_config 0.4.5 [checked_yaml json_annota tion meta path pubspec_parse yaml] - build_daemon 2.1.8 [built_collection built_v alue http_multi_server logging pedantic path p ool shelf shelf_web_socket stream_transform wa tcher web_socket_channel] - build_resolvers 1.5.3 [analyzer build crypto graphs logging meta path package_config pool pub_semver] - build_runner_core 6.1.7 [async build build_c onfig build_resolvers collection convert crypt o glob graphs logging meta path package_config pedantic pool timing watcher yaml] - built_collection 5.0.0 - built_value 8.0.0 [built_collection collecti on fixnum] - characters 1.1.0 - charcode 1.2.0 - checked_yaml 1.0.4 [json_annotation source_s pan yaml] - cli_util 0.2.0 [path] - clock 1.1.0 - cloud_firestore_platform_interface 3.0.2 [fl utter meta collection firebase_core plugin_pla tform_interface] - cloud_firestore_web 0.3.0+2 [flutter flutter _web_plugins http_parser meta firebase_core fi rebase_core_web cloud_firestore_platform_inter face js] - code_builder 3.6.0 [built_collection built_v alue collection matcher meta] - collection 1.15.0 - convert 2.1.1 [charcode typed_data] - crypto 2.1.5 [collection convert typed_data] - dart_style 1.3.10 [analyzer args path source _span] - fake_async 1.2.0 [clock collection] - ffi 0.1.3 - file 6.0.0 [meta path] - firebase 7.3.3 [http http_parser js] - firebase_analytics_platform_interface 1.0.3 [flutter meta] - firebase_analytics_web 0.1.1 [flutter flutte r_web_plugins firebase firebase_analytics_plat form_interface meta] - firebase_auth_platform_interface 3.1.0 [flut ter meta firebase_core plugin_platform_interfa ce] - firebase_auth_web 0.3.3 [flutter flutter_web _plugins meta http_parser intl firebase_core f irebase_core_web firebase_auth_platform_interf ace js] - firebase_core_platform_interface 3.0.1 [flut ter meta plugin_platform_interface quiver] - firebase_core_web 0.2.1+3 [firebase_core_pla tform_interface flutter flutter_web_plugins me ta js] - firebase_crashlytics_platform_interface 1.1. 6 [flutter meta collection firebase_core plugi n_platform_interface] - fixnum 1.0.0 - flutter_driver 0.0.0 [file meta path vm_serv ice webdriver flutter flutter_test fuchsia_rem ote_debug_protocol archive args async boolean_ selector characters charcode clock collection convert crypto fake_async matcher platform pro cess source_span stack_trace stream_channel st ring_scanner sync_http term_glyph test_api typ ed_data vector_math] - flutter_web_plugins 0.0.0 [flutter js charac ters collection meta typed_data vector_math] - fuchsia_remote_debug_protocol 0.0.0 [process vm_service file meta path platform] - glob 1.2.0 [async collection node_io path pe dantic string_scanner] - graphs 0.2.0 - http 0.12.2 [http_parser path pedantic] - http_multi_server 2.2.0 [async] - http_parser 3.1.4 [charcode collection sourc e_span string_scanner typed_data] - image 2.1.19 [archive xml meta] - intl 0.16.1 [path] - io 0.3.4 [charcode meta path string_scanner] - js 0.6.3 - json_annotation 3.1.1 - logging 1.0.0 - matcher 0.12.10 [stack_trace] - meta 1.3.0 - mime 1.0.0 - nested 1.0.0 [flutter] - node_interop 1.2.1 [js] - node_io 1.1.1 [node_interop path] - package_config 1.9.3 [path charcode] - path 1.8.0 - path_provider 1.6.27 [flutter path_provider_ platform_interface path_provider_macos path_pr ovider_linux path_provider_windows] - path_provider_linux 0.0.1+2 [path xdg_direct ories path_provider_platform_interface flutter ] - path_provider_macos 0.0.4+8 [flutter] - path_provider_platform_interface 1.0.4 [flut ter meta platform plugin_platform_interface] - path_provider_windows 0.0.4+3 [path_provider _platform_interface meta path flutter ffi win3 2] - pedantic 1.10.0 - petitparser 3.1.0 [meta] - platform 3.0.0 - plugin_platform_interface 1.0.3 [meta] - pool 1.5.0 [async stack_trace] - process 4.0.0 [file path platform] - provider 4.3.3 [collection flutter nested] - pub_semver 1.4.4 [collection] - pubspec_parse 0.1.8 [checked_yaml json_annot ation pub_semver yaml] - quiver 2.1.5 [matcher meta] - shelf 0.7.9 [async collection http_parser pa th stack_trace stream_channel] - shelf_web_socket 0.2.4+1 [shelf stream_chann el web_socket_channel] - sky_engine 0.0.99 - source_gen 0.9.10+2 [analyzer async build da rt_style glob meta path pedantic source_span] - source_span 1.8.0 [charcode 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.0 [charcode source_span] - sync_http 0.2.0 - term_glyph 1.2.0 - test_api 0.2.19 [async boolean_selector coll ection meta path source_span stack_trace strea m_channel string_scanner term_glyph matcher] - timing 0.1.1+3 [json_annotation] - typed_data 1.3.0 [collection] - vector_math 2.1.0 - vm_service 5.5.0 [meta] - watcher 0.9.7+15 [async path pedantic] - web_socket_channel 1.2.0 [async crypto strea m_channel] - webdriver 2.1.2 [archive matcher path stack_ trace sync_http] - win32 1.7.4+1 [ffi] - xdg_directories 0.1.2 [meta path process] - xml 4.5.1 [collection convert meta petitpars er] - yaml 2.2.1 [charcode collection string_scann er source_span] ```