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.66k stars 3.96k forks source link

[<Firebase_Auth>] Unhandled Platform Exception Before Able to Catch SignInWithEmailAndPassword FirebaseAuthException #3475

Closed GrahamDi closed 4 years ago

GrahamDi commented 4 years ago

3341 Relates to this.

Bug Description

I have just upgraded to the new FlutterFire library and am experiencing the above with the new version of firebase_auth (0.18.0+1), which did not occur in the previous version I used (0.16.1).

Here is a code snippet of my email/password authentication method.

auth.User _user;
          try {
            _user = (await _firebaseAuth.signInWithEmailAndPassword(
              email: email,
              password: password,
            ))
                .user;                    
          } on auth.FirebaseAuthException catch (e) {
            printMessage("FirebaseAuthException code: ${e.code}",
                isErrorMessage: true);
            _determineErrorCode(e);
            _user = null;
          } on Exception catch (e) {
            printMessage("Exception code: ${e.toString()}",
                isErrorMessage: true);
            _determineErrorCode(e);
            _user = null;
          }

The problem is that a platform exception is being triggered immediately after the call to signInWithEmailAndPassword and before the on auth.FirebaseAuthException catch (e) { block. The exception stops the code (unless I uncheck breakpoints, unhandled exceptions in my VSCode debugger - I see from the issue referenced above that it worked in Android Studio but it is not clear if AS was set to trap unhandled errors. I don't know AS that well.)

The exception occurs at line 572 in C:\flutter\packages\flutter\lib\src\services\message_codecs.dart

if (errorCode is String && (errorMessage == null || errorMessage is String) && !buffer.hasRemaining)
line 572 =>      throw PlatformException(code: errorCode, message: errorMessage as String, details: errorDetails);
    else
      throw const FormatException('Invalid envelope');
  }

The error message thrown is:

Exception has occurred. PlatformException (PlatformException(firebase_auth, com.google.firebase.auth.FirebaseAuthInvalidUserException: There is no user record corresponding to this identifier. The user may have been deleted., {code: user-not-found, additionalData: {}, message: There is no user record corresponding to this identifier. The user may have been deleted.}))

This is called from line 361 in C:\flutter\packages\flutter\lib\src\services\platform_channel.dart

Future<Map<K, V>> invokeMapMethod<K, V>(String method, [ dynamic arguments ]) async {
line 361=>    final Map<dynamic, dynamic> result = await invokeMethod<Map<dynamic, dynamic>>(method, arguments);
    return result?.cast<K, V>();
  }

If I continue the code run then the FirebaseAuthException block processes the firebase exception correctly. Similarly, if I turn off the unhandled exceptions check, the platform error is not seen and the FirebaseAuthException block shows the correct error message.

Steps to Reproduce

Simply enter an non-existant or badly formatted email address, or an invalid password to an existing address as the parameters to the signInWithEmailAndPassword method and the platform error will occur.

Expected behavior

I would expect the platform error not to occur or to propagate the error correctly ie. to be handled.

Flutter doctor

flutter doctor -v [√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.20206.1000], locale en-ZA) • Flutter version 1.20.2 at C:\flutter • Framework revision bbfbf1770c (3 weeks ago), 2020-08-13 08:33:09 -0700 • Engine revision 9d5b21729f • Dart version 2.9.1

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0) • Android SDK at D:\Android\Sdk • Platform android-30, build-tools 29.0.0 • ANDROID_HOME = D:\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03) • All Android licenses accepted.

[√] Android Studio (version 3.5) • Android Studio at C:\Program Files\Android\Android Studio1 • Flutter plugin version 43.0.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.48.2) • VS Code at C:\Users\dicki\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.14.0

[√] Connected device (1 available) • AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

• No issues found!

darshankawar commented 4 years ago

Hi @GrahamDi, I tried below code sample on latest dev and was able to see expected FirebaseAuthException, if I put an invalid email or password for signInWithEmailAndPassword() method.

void _signIn() async {
    try {
      User user = (await FirebaseAuth.instance.signInWithEmailAndPassword(
          email: _emailController.text, password: _passController.text)).user;
    }
    on FirebaseAuthException catch (e) {
      if (e.code == 'user-not-found') {
        print('No user found for that email.');
      } else if (e.code == 'wrong-password') {
        print('Wrong password provided for that user.');
      }
    }
  }
I/flutter ( 7067): No user found for that email.
I/flutter ( 7067): No user found for that email.
flutter doctor -v ``` [✓] Flutter: is fully installed. (Channel dev, 1.22.0-9.0.pre, on Mac OS X 10.15.2 19C57, locale en-US) [!] Android toolchain - develop for Android devices: is partially installed; more components are available. (Android SDK version 29.0.3) [✓] Xcode - develop for iOS and macOS: is fully installed. (Xcode 11.6) [✓] Chrome - develop for the web: is fully installed. [✓] Android Studio: is fully installed. (version 3.6) [✓] Connected device: is fully installed. (5 available) ```

I followed this example. Can you try same and see if it works for you ? Thanks.

GrahamDi commented 4 years ago

@darshankawar
Hi,

Did you run this in VSCode in debug mode and was the Uncaught Exceptions box in the Breakpoints section ticked? It appears from your flutter doctor that you used Android Studio only. So we are not comparing apples with apples. As I mentioned above and is highlighted in the referenced issue at the top...it appears to work in Android Studio, but VSCode picks up an unhandled exception when running in debug mode with unhandled exceptions ticked. This exception did not manifest itself in version 0.16.1

darshankawar commented 4 years ago

@GrahamDi, You are correct. I tried it on AS, since I don't have VSCode.

GrahamDi commented 4 years ago

@darshankawar

Ok, will someone else be able to check this issue using VSCode?

darshankawar commented 4 years ago

@GrahamDi, let me try on VSCode.

darshankawar commented 4 years ago

@GrahamDi,

On latest master in VSCode, unable to see the exception:

Screenshot 2020-09-07 at 6 56 14 PM
code sample ``` import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_signin_button/flutter_signin_button.dart'; import './register_page.dart'; import './signin_page.dart';Future main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); runApp(MyApp()); }class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Material App', theme: ThemeData.dark(), home: Home(), ); } }class Home extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Material App Bar'), ), body: Center( child: Container( child: Text('Hello World'), ), ), floatingActionButton: FloatingActionButton( child: Icon(Icons.add), onPressed: () async => _signIn(), ), ); } void _signIn() async { try { User user = (await FirebaseAuth.instance.signInWithEmailAndPassword( email: 'me@google.com', password: '123456')) .user; } on FirebaseAuthException catch (e) { if (e.code == 'user-not-found') { print('No user found for that email.'); } else if (e.code == 'wrong-password') { print('Wrong password provided for that user.'); } } } } ```
GrahamDi commented 4 years ago

@darshankawar

That's very strange. I'm still seeing it with Flutter Channel stable, 1.20.3 and Dart 2.9.2

I will try and do some more investigation when I get time. Guess you may as well close this.

Salakar commented 4 years ago

@GrahamDi what version of firebase_auth are you on, you skipped a section on the issue template:

### Flutter dependencies

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

<details><summary>Click To Expand</summary>

PASTE OUTPUT INSIDE HERE


</details>
GrahamDi commented 4 years ago

@Salakar Hi Mike, Yeah I did skip that...sorry. Here is the output:

flutter pub deps -- --style=compact
Dart SDK 2.9.2
Flutter SDK 1.20.3
sailorboy 1.0.0+8

dependencies:
- auto_size_text 2.1.0 [flutter]
- basic_utils 2.6.2 [http logging json_annotation pointycastle asn1lib convert crypto]
- cached_network_image 2.3.1 [flutter flutter_cache_manager octo_image]
- catcher 0.3.19 [flutter flutter_web_plugins fluttertoast device_info package_info mailer dio flutter_mailer logging sentry]
- flutter_geofire 1.0.3 [flutter]
- flutter_localizations 0.0.0 [flutter intl characters collection meta path typed_data vector_math]
- flutter_native_splash 0.1.9 [yaml image color]
- flutter_spinkit 4.1.2+1 [flutter]
- flutter_splash_screen 0.1.0 [flutter]
- flutter_staggered_grid_view 0.3.2 [flutter]
- flutter_typeahead 1.8.8 [flutter flutter_keyboard_visibility]
- fluttertoast 7.0.4 [flutter flutter_web_plugins]
- geocoding 1.0.3 [flutter geocoding_platform_interface url_launcher]
- geolocator 6.0.0+2 [flutter geolocator_platform_interface]
- get_it 4.0.4 [async meta]
- google_sign_in 4.5.3 [google_sign_in_platform_interface flutter meta google_sign_in_web]
- http 0.12.2 [http_parser path pedantic]
- image_downloader 0.20.0 [flutter]
- image_picker 0.6.7+7 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- in_app_purchase 0.3.4+5 [async collection flutter json_annotation meta]
- package_info 0.4.3 [flutter]
- permission_handler 5.0.1+1 [flutter meta permission_handler_platform_interface]
- recase 3.0.0
- rflutter_alert 1.0.3 [flutter]
- rxdart 0.24.1
- scoped_model 1.0.1 [flutter]
- shared_preferences 0.5.10 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web]
- string_validator 0.1.4
- tuple 1.0.3 [quiver]
- url_launcher 5.5.2 [flutter url_launcher_platform_interface url_launcher_web url_launcher_linux url_launcher_macos]
- yaml2podo 0.1.26 [args analyzer build dart_style path yaml]

dev dependencies:
- effective_dart 1.2.4
- flutter_driver 0.0.0 [file json_rpc_2 meta path web_socket_channel vm_service_client webdriver flutter flutter_test fuchsia_remote_debug_protocol archive args async boolean_selector characters charcode clock collection convert crypto fake_async intl matcher platform process pub_semver source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math]
- flutter_launcher_icons 0.7.5 [image args yaml]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]     
- test 1.15.2 [analyzer async boolean_selector coverage http http_multi_server io js node_preamble package_config path pedantic pool shelf shelf_packages_handler shelf_static shelf_web_socket source_span stack_trace stream_channel typed_data web_socket_channel webkit_inspection_protocol yaml test_api test_core]

transitive dependencies:
- _fe_analyzer_shared 7.0.0 [meta]
- analyzer 0.39.17 [_fe_analyzer_shared args charcode cli_util collection convert crypto glob html meta package_config path pub_semver source_span watcher yaml]
- archive 2.0.13 [crypto args path]
- args 1.6.0
- asn1lib 0.6.5
- async 2.4.2 [collection]
- boolean_selector 2.0.0 [source_span string_scanner]
- build 1.3.0 [analyzer async convert crypto logging meta path glob]
- characters 1.0.0
- charcode 1.1.3
- cli_util 0.2.0 [path]
- clock 1.0.1 [meta]
- cloud_functions_platform_interface 2.0.0 [flutter meta firebase_core plugin_platform_interface]
- cloud_functions_web 2.0.0 [cloud_functions_platform_interface flutter flutter_web_plugins firebase http_parser meta]
- collection 1.14.13
- color 2.1.1
- connectivity_for_web 0.3.1+2 [connectivity_platform_interface flutter_web_plugins flutter]
- connectivity_macos 0.1.0+4 [flutter]
- connectivity_platform_interface 1.0.6 [flutter meta plugin_platform_interface]
- convert 2.1.1 [charcode typed_data]
- coverage 0.14.0 [args logging package_config path source_maps stack_trace vm_service]
- crypto 2.1.5 [collection convert typed_data]
- csslib 0.16.2 [source_span]
- dart_style 1.3.6 [analyzer args path source_span]
- device_info_platform_interface 1.0.0 [flutter meta plugin_platform_interface]
- dio 3.0.10 [http_parser path]
- fake_async 1.1.0 [clock collection]
- file 5.2.1 [intl meta path]
- firebase 7.3.0 [http http_parser js]
- firebase_analytics_platform_interface 1.0.3 [flutter meta]
- firebase_analytics_web 0.1.1 [flutter flutter_web_plugins firebase firebase_analytics_platform_interface meta]
- firebase_auth_platform_interface 2.0.1 [flutter meta firebase_core plugin_platform_interface]
- firebase_auth_web 0.3.0+1 [flutter flutter_web_plugins firebase meta http_parser intl firebase_core firebase_auth_platform_interface js]
- firebase_core_platform_interface 2.0.0 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.0 [firebase firebase_core_platform_interface flutter flutter_web_plugins meta js]
- flutter_blurhash 0.5.0 [flutter meta]
- flutter_keyboard_visibility 3.2.2 [flutter]
- flutter_mailer 0.5.1 [flutter]
- flutter_plugin_android_lifecycle 1.0.8 [flutter]
- flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
- fuchsia_remote_debug_protocol 0.0.0 [json_rpc_2 process web_socket_channel flutter_test flutter_driver archive args async boolean_selector charcode clock collection convert crypto fake_async file intl matcher meta path platform pub_semver source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math vm_service_client webdriver]
- geocoding_platform_interface 1.0.0+3 [flutter meta plugin_platform_interface]
- geolocator_platform_interface 1.0.4 [flutter meta plugin_platform_interface vector_math]
- glob 1.2.0 [async collection node_io path pedantic string_scanner]
- google_sign_in_platform_interface 1.1.2 [flutter meta quiver]
- google_sign_in_web 0.9.1+1 [google_sign_in_platform_interface flutter flutter_web_plugins meta js]
- html 0.14.0+3 [csslib source_span]
- http_multi_server 2.2.0 [async]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image 2.1.14 [archive xml]
- image_picker_platform_interface 1.1.0 [flutter meta http plugin_platform_interface]
- intl 0.16.1 [path]
- io 0.3.4 [charcode meta path string_scanner]
- js 0.6.2
- json_annotation 3.0.1
- json_rpc_2 2.2.1 [stack_trace stream_channel]
- logging 0.11.4
- mailer 3.0.4 [async logging intl mime path pedantic]
- matcher 0.12.8 [stack_trace]
- meta 1.1.8
- mime 0.9.7
- node_interop 1.1.1 [js]
- node_io 1.1.1 [node_interop path]
- node_preamble 1.4.12
- octo_image 0.2.1 [flutter flutter_blurhash]
- package_config 1.9.3 [path charcode]
- path 1.7.0
- path_provider 1.6.14 [flutter path_provider_platform_interface path_provider_macos path_provider_linux]
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 0.0.4+3 [flutter]
- path_provider_platform_interface 1.0.3 [flutter meta platform plugin_platform_interface]
- pedantic 1.9.0
- permission_handler_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- petitparser 3.0.4 [meta]
- platform 2.2.1
- platform_detect 1.4.0 [meta pub_semver]
- plugin_platform_interface 1.0.2 [meta]
- pointycastle 1.0.2
- pool 1.4.0 [async stack_trace]
- process 3.0.13 [file intl meta path platform]
- pub_semver 1.4.4 [collection]
- quiver 2.1.3 [matcher meta]
- sentry 3.0.1 [http meta stack_trace usage pedantic]
- shared_preferences_linux 0.0.2+2 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 0.0.1+10 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 1.0.4 [meta flutter]
- shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- shelf 0.7.9 [async collection http_parser path stack_trace stream_channel]
- shelf_packages_handler 2.0.0 [path shelf shelf_static]
- shelf_static 0.2.8 [convert http_parser mime path shelf]
- shelf_web_socket 0.2.3 [shelf web_socket_channel stream_channel]
- sky_engine 0.0.99
- source_map_stack_trace 2.0.0 [path stack_trace source_maps]
- source_maps 0.10.9 [source_span]
- source_span 1.7.0 [charcode collection meta path term_glyph]
- sqflite 1.3.1+1 [flutter sqflite_common path]
- sqflite_common 1.0.2+1 [synchronized path meta]
- stack_trace 1.9.5 [path]
- stream_channel 2.0.0 [async]
- string_scanner 1.0.5 [charcode meta source_span]
- sync_http 0.2.0
- synchronized 2.2.0+2
- term_glyph 1.1.0
- test_api 0.2.17 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- test_core 0.3.10 [analyzer async args boolean_selector collection coverage glob io meta package_config path pedantic pool source_map_stack_trace source_maps source_span stack_trace stream_channel vm_service yaml matcher test_api]
- typed_data 1.2.0 [collection]
- url_launcher_linux 0.0.1+1 [flutter]
- url_launcher_macos 0.0.1+7 [flutter]
- url_launcher_platform_interface 1.0.8 [flutter meta plugin_platform_interface]
- url_launcher_web 0.1.3 [url_launcher_platform_interface platform_detect flutter flutter_web_plugins meta]
- usage 3.4.2 [path]
- uuid 2.2.2 [crypto convert]
- vector_math 2.0.8
- vm_service 4.2.0 [meta]
- vm_service_client 0.2.6+2 [async collection json_rpc_2 pub_semver source_span stack_trace stream_channel web_socket_channel]
- watcher 0.9.7+15 [async path pedantic]
- web_socket_channel 1.1.0 [async crypto stream_channel]
- webdriver 2.1.2 [archive matcher path stack_trace sync_http]
- webkit_inspection_protocol 0.7.3 [logging]
- xdg_directories 0.1.0 [path process flutter]
- xml 4.2.0 [collection convert meta petitparser]
- yaml 2.2.1 [charcode collection string_scanner source_span]

Flutter Doctor latest: flutter doctor -v [√] Flutter (Channel stable, 1.20.3, on Microsoft Windows [Version 10.0.20206.1000], locale en-ZA) • Flutter version 1.20.3 at C:\flutter • Framework revision 216dee60c0 (6 days ago), 2020-09-01 12:24:47 -0700 • Engine revision d1bc06f032 • Dart version 2.9.2

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0) • Android SDK at D:\Android\Sdk • Platform android-30, build-tools 29.0.0 • ANDROID_HOME = D:\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03) • All Android licenses accepted.

[√] Android Studio (version 3.5) • Android Studio at C:\Program Files\Android\Android Studio1 • Flutter plugin version 43.0.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.48.2) • VS Code at C:\Users\dicki\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.14.1

[!] Connected device ! No devices available

! Doctor found issues in 1 category.

jhandaya commented 4 years ago

i Think I have same issue with this

I use VS Code, but it happen at reauthenticateWithCredential

I did post issue at https://github.com/FirebaseExtended/flutterfire/issues/3488

jhandaya commented 4 years ago

I just Debug with Android Studio and this issue occur

PlatformException(firebase_auth, com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The password is invalid ..

Message_codecs.dart

if ((errorCode is String) && (errorMessage == null || errorMessage is String) && !buffer.hasRemaining) throw PlatformException(code: errorCode, message: errorMessage as String, details: errorDetails);

Dart SDK 2.9.2 Flutter SDK 1.20.3 mistercut 1.0.0+1

dependencies:

dev dependencies:

transitive dependencies:

jhandaya commented 4 years ago

image

jhandaya commented 4 years ago

image

GrahamDi commented 4 years ago

@jhandaya @Salakar @darshankawar This is the same platform exception at the same place that I am seeing and that stops my code before on FirebaseAuthException traps anything.

jaxnz commented 4 years ago

Yes - getting the same Platform Exception after updating - I get this error when running flutter pub deps -- --style=compact

flutter pub deps -- --style=compact
Could not find a file named "pubspec.yaml" in "C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.14.0+2".
pub finished with exit code 66
darshankawar commented 4 years ago

I am able to replicate this issue on latest stable (1.20.3) while debugging signInWithEmailAndPassword() method from firebase_auth's official example in Android Studio on Android device 8.1.0.

Screen Shot 2020-09-09 at 3 22 36 PM Screen Shot 2020-09-09 at 3 23 16 PM

Steps to replicate:

  1. Run firebase_auth official example plugin.
  2. Tap on Test SignIn/SignOut.
  3. Put debugger on void _signInWithEmailAndPassword() method and run in debug mode.
  4. Enter valid email and invalid password and hit submit.
  5. Debug the method and observe that it throws PlatformException, as shown in screenshots above.
flutter doctor -v ``` [✓] Flutter (Channel stable, 1.20.3, on Mac OS X 10.15.2 19C57, locale en-US) • Flutter version 1.20.3 at /Users/deeptibelsare/Documents/Fluttersdk/flutter • Framework revision 216dee60c0 (8 days ago), 2020-09-01 12:24:47 -0700 • Engine revision d1bc06f032 • Dart version 2.9.2 [!] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at /Users/deeptibelsare/Library/Android/sdk • Platform android-30, build-tools 29.0.3 • ANDROID_HOME = /Users/deeptibelsare/Library/Android/sdk • ANDROID_SDK_ROOT = /Users/deeptibelsare/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211) ✗ Android license status unknown. Try re-installing or updating your Android SDK Manager. See https://developer.android.com/studio/#downloads or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions. [✓] Xcode - develop for iOS and macOS (Xcode 11.6) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.6, Build version 11E708 • CocoaPods version 1.9.3 [✓] Android Studio (version 3.6) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 45.1.1 • Dart plugin version 192.7761 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211) [✓] Connected device (2 available) • SM A260G (mobile) • 5200763ebcfa861f • android-arm • Android 8.1.0 (API 27) • Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios • iOS 13.6 ! Doctor found issues in 1 category. ```
jaxnz commented 4 years ago

This is still a major issue - is there any update?

andresluna17 commented 4 years ago

this the problem This problem continues to appear, in the previous version 0.16 there is no problem, in 0.18 it also presents me with this error, the solution in my case was to use version 0.16

ocastx commented 4 years ago

@darshankawar As there are no updates on this issue: Is this something that is worked on? Or waiting for more details?

This seems to be a rather major issue because the exception is not catchable and debug apps are crashing on simple errors (like 'wrong-password')

jslattery26 commented 4 years ago

I'm still having this issue as well. Can't catch any errors around creating and signing in to accounts.

GrahamDi commented 4 years ago

@darshankawar Would be nice to have an idea of what the likely next steps are and some idea of when. I see no one is assigned to this yet.

This is, after all, a rather key package in the Flutter / Firebase environment.

Ehesp commented 4 years ago

So I guess this is an oversight of internally throwing an exception internally, and expecting the error to be caught (handled) in user-land code.

I'll pick this one up next week - it's somehow being classes as unhandled even after being wrapped in a try-catch.

I suspect this comment is the same/similar issue with async/awaits.

GrahamDi commented 4 years ago

Much appreciated. When you sort it out, please would you let us know how it should have been handled in 'userland' ie.why my try/catch, which does have async/await, did not pick it up. Thanks a lot.

Ehesp commented 4 years ago

This issue is also very relevant: https://github.com/flutter/flutter/issues/33427

TLDR: This is a wider issue than this repo, however there is something which seems to pop up and that's when try/catch is used alongside a Future .catchError. I wonder whether wrapping the method channel calls within a try/catch and throwing will "fix" the issue. I'll have a dig into it and see what I come up with.

GrahamDi commented 4 years ago

Thanks for the other link, I hadn't spotted it. Also, having read through it I am sure I have also experienced 'sporadic' uncaught errors on flutter cached network image, which I see is mentioned, and other things and that I thought I should have trapped. Looks like there is something more fundamental going wrong here. Hope you can find it.

ananth-hegde commented 4 years ago

Sorry if this does not go where its supposed to, I'm still new to GitHub. Reading through, I've understood that using firebase_auth 0.16.1 will not end up with this exception going uncaught. Unfortunately, I don't have a week, I'm just a college student and my deadline is 3 days. I just wanted to know if my issue will be fixed if I use the previous version, and if someone has a link to it's documentation, I would be eternally in your favour

GrahamDi commented 4 years ago

Hi,

From what I am seeing, this issue causes a problem when debugging the app in Android Studio or VSCode and when uncaught exception tracking is turned on. When I run a release version on my phone the app behaves normally and I trap eg. a bad password or an invalid email address. So, I assume for your deadline you will be using a release version? Hence, there should be no problem.

Hope that helps.

Krgrds, Graham

On Fri, 25 Sep 2020, 20:29 ananth-hegde, notifications@github.com wrote:

Sorry if this does not go where its supposed to, I'm still new to GitHub. Reading through, I've understood that using firebase_auth 0.16.1 will not end up with this exception going uncaught. Unfortunately, I don't have a week, I'm just a college student and my deadline is 3 days. I just wanted to know if my issue will be fixed if I use the previous version, and if someone has a link to it's documentation, I would be eternally in your favour

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FirebaseExtended/flutterfire/issues/3475#issuecomment-699085069, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVES4ES3OVT74HZ6RRNRGLSHTOPFANCNFSM4Q4OFOMQ .

ananth-hegde commented 4 years ago

Hey,

Thanks a lot. I'll be using a release version, yes. So I'll just need to catch it as a PlatformException or will it be covered under my FirebaseAuthException? Just need to know where the snackbar needs to be displayed.

GrahamDi commented 4 years ago

So, at the moment I am throwing the kitchen sink at it because of the strange uncaught exception. My try catch has: on PlatformException, on FirebaseAuthException, and on Exception / simple catch. I just make sure whichever block triggers, it provides an error message /code back to my UI so that I can show an error dialogue.

Krgrds, Graham

On Fri, 25 Sep 2020, 21:17 ananth-hegde, notifications@github.com wrote:

Hey,

Thanks a lot. I'll be using a release version, yes. So I'll just need to catch it as a PlatformException or will it be covered under my FirebaseAuthException? Just need to know where the snackbar needs to be displayed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FirebaseExtended/flutterfire/issues/3475#issuecomment-699108217, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVES4GJ7Y5OBLWYEUHV3XTSHTUFJANCNFSM4Q4OFOMQ .

ananth-hegde commented 4 years ago

I'll do the same, just put the snackbar in both places and let the flutter gods take the wheel. Thanks a lot for your inputs, I've been grappling with this for the last 2 days and just came to know its not an error on my part. You're a lifesaver.

GrahamDi commented 4 years ago

Glad I could help. Good luck with your deadline and results. Let me know how it goes....and enjoy Flutter!

Krgrds, Graham

On Fri, 25 Sep 2020, 21:48 ananth-hegde, notifications@github.com wrote:

I'll do the same, just put the scaffold in both places and let the flutter gods take the wheel. Thanks a lot for your inputs, I've been grappling with this for the last 2 days and just came to know its not an error on my part. You're a lifesaver.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FirebaseExtended/flutterfire/issues/3475#issuecomment-699121695, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVES4HWZ6LUYP6AZ3GLRW3SHTXYDANCNFSM4Q4OFOMQ .

Ehesp commented 4 years ago

Yeah the issue here is with your IDEs handling exceptions (thinking its uncaught), so will be fine in prod, it's just an annoyance to deal with whilst testing.

I just wanted to know if my issue will be fixed if I use the previous version, and if someone has a link to it's documentation, I would be eternally in your favour

No docs exist before the current version sorry!

Ehesp commented 4 years ago

Ok managed to replicate and "fix".

https://github.com/flutter/flutter/issues/33427 pretty much sums up the overall issue (news to me!). Basically the .catchError statements within a try/catch aren't seen as a parent exception handler to the IDE so although Dart actually catches the error and deals with it (the reason why using the code without debugging works), the IDE kicks up a fuss.

I just converted everything to try/catch, and explicitly throw an exception.

Need to sort for the other plugins but if anyone can test my PR via pubspec git hash please do!

ocastx commented 4 years ago

Thanks, @Ehesp!

I just upgraded to the latest version again and experiencing the bug as well. Now I wanted to test your PR, but I am unsure if I configured the pubspec right for the package:

  #firebase_auth: "0.18.0+1" # Upgrade as soon as this is fixed https://github.com/FirebaseExtended/flutterfire/issues/3475
  firebase_auth: 
    git:
      url: git@github.com:FirebaseExtended/flutterfire.git
      ref: fix-3475
      path: 'packages/firebase_auth/firebase_auth'

Is this correct?

Ehesp commented 4 years ago

I think ref should be 7303514b501809431773cccec7ea0c0ba114529f, not sure if you need path either.

ocastx commented 4 years ago

Okay – I set path because if I don't I get the following error

Could not find a file named "pubspec.yaml" in git@github.com:FirebaseExtended/flutterfire.git 7303514b501809431773cccec7ea0c0ba114529f.
pub get failed (1; Could not find a file named "pubspec.yaml" in git@github.com:FirebaseExtended/flutterfire.git 

Which I think is correct because the pubspec is in the sub-folder of the package (packages/firebase_auth/firebase_auth)

ghost commented 3 years ago

I still have this issue, did you get it solved?

andresluna17 commented 3 years ago

This is not a problem with the firebaseAuth library but with your editor or IDE

GrahamDi commented 3 years ago

@andresluna17 Not true. Read https://github.com/FirebaseExtended/flutterfire/issues/3475#issuecomment-701233145

intraector commented 3 years ago

any news on this?