Skip to content

[firebase_auth] native error messages not provided #1456

Closed
@heejongahn

Description

@heejongahn

Describe the bug
I tried to implement anonymous sign-in feature, such as:

  initialize() async {
    _auth.onAuthStateChanged.listen(_onAuthStateChanged);
    _user = await _auth.currentUser();

    if (_user == null) {
      await _auth.signInAnonymously();
    } else {
      _user.reload();
    }
  }

and ended up with await _auth.signInAnonymously(); throwing the error below. (note that it doesn't contain any useful error code, message etc.)

flutter: PlatformException(ERROR_INTERNAL_ERROR, An internal error has occurred, print and inspect the error details for more information., null)

After hours of debugging, I finally figured out that I haven't turned anonymous sign-in method on at Firebase console. Yes, it was a silly mistake but it would've been caught much much faster if the error message contained ERROR_OPERATION_NOT_ALLOWED, as documented.

I believe this lack of information is not an intended behavior.

To Reproduce
I'm not sure it's method-specific situation or just an general issue. In my case, it was caused when I tried to call signInAnonymously with the related setting off.

Expected behavior
Error message contains proper error code and message.

Additional context
flutter doctor -v:

[✓] Flutter (Channel beta, v1.10.7, on Mac OS X 10.15 19A602, locale ko-KR)
    • Flutter version 1.10.7 at /Users/maru/dev/flutter
    • Framework revision e70236e36c (7주 전), 2019-10-02 09:32:30 -0700
    • Engine revision 9e6314d348
    • Dart version 2.6.0 (build 2.6.0-dev.0.0 1103600280)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/maru/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Users/maru/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.2, Build version 11B52
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.3)
    • Android Studio at /Users/maru/Applications/Android Studio.app/Contents
    • Flutter plugin version 33.3.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] VS Code (version 1.40.0)
    • VS Code at /Users/maru/Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.6.0

[✓] Connected device (1 available)
    • iPhone 11 Pro Max • B4292982-E8A1-478B-A5BD-9527FD33DD69 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-2 (simulator)

• No issues found!

pubspec.yaml:

name: galpi
description: A new Flutter project.
version: 1.0.4

environment:
  sdk: ">=2.3.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  http: ^0.12.0+2
  sqflite: ^1.1.5
  path_provider: ^1.1.0
  tuple: ^1.0.2
  intl: ^0.16.0
  webview_flutter: ^0.3.10
  package_info: ^0.4.0
  shared_preferences: ^0.5.3+4
  rxdart: 0.22.1+1
  firebase_core: ^0.4.1+5
  firebase_auth: ^0.15.0
  provider: ^3.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked: customer-responseWaiting for customer response, e.g. more information was requested.impact: crowdAffects many people, though not necessarily a specific customer with an assigned label. (P2)plugin: authresolution: needs-reproThis issue could not be reproduced or needs an up to date reproduction on latest FlutterFire plugin.type: bugSomething isn't workingtype: missing-featureA feature that is supported on the underlying Firebase SDK but has not been exposed to Dart API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions