You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter Firebase电话认证出现[firebase_auth/internal-error]生产环境故障求助

Firebase电话认证突发内部错误排查求助

生产环境Flutter应用集成Firebase电话认证功能,此前运行正常,但自昨日起所有用户均无法登录。调试时日志报错:

[firebase_auth/internal-error] An internal error has occurred, print and inspect the error details for more information.

执行认证的Dart代码片段:

void onSubmit(BuildContext context) async {
    final form = formKey.currentState!;
    form.saveAndValidate();

    final phone = form.value[_FormKeys.phone] as String?;
    if (phone == null) return;

    FocusScope.of(context).unfocus();

    final result = await AppFormValidator.lazyPhone(phone, country);
    invalidPhone = result == null;
    notifyListeners();

    WidgetsBinding.instance.addPostFrameCallback((_) async {
      final isValid = formKey.currentState!.saveAndValidate();
      if (!isValid) return;

      loading = true;
      notifyListeners();

      await FirebaseAuth.instance.verifyPhoneNumber(
        phoneNumber: result!.e164,
        timeout: 60.seconds,
        verificationCompleted: (PhoneAuthCredential credential) async {},
        verificationFailed: (FirebaseAuthException e) {
          final message = FireAuth.exceptionMessage(e.code);
          Crashlytics.recordEvent(e, e.stackTrace);
          SnackBars.failure(context, message);
          loading = false;
          notifyListeners();
        },
        codeSent: (String verificationId, int? resendToken) {
          loading = false;
          AppRoutes.loginVerify.push(context, arguments: {
            'verificationId': verificationId,
            'phoneNumber': phone,
            'countryCode': result.countryCode,
          });
        },
        codeAutoRetrievalTimeout: (String verificationId) {},
      );
      loading = false;
    });
  }

已尝试的解决方案:

  • 查阅Stack Overflow相关问题
  • 查阅FlutterFire官方Issue
  • 确认云平台密钥无访问限制
  • 确认Firebase已启用电话认证
  • 验证GoogleServices-Info.plist的APP ID与Firebase匹配
  • Firebase项目为Blaze套餐且已启用身份支持

pubspec.yaml相关依赖版本:

# firebase
  firebase_core: ^2.27.0
  firebase_auth: ^4.17.5
  cloud_firestore: ^4.15.0
  firebase_storage: ^11.6.1
  firebase_crashlytics: ^3.4.10
  firebase_dynamic_links: ^5.4.9
  geoflutterfire2: ^2.3.15

  # notifications
  firebase_messaging: ^14.7.11
  flutter_local_notifications: ^17.0.0

Flutter环境检查结果:

[✓] Flutter (Channel stable, 3.19.4, on macOS 14.2.1 23C71 darwin-arm64, locale en-PK)
    • Flutter version 3.19.4 on channel stable at /Users/hamza/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 68bfaea224 (2 days ago), 2024-03-20 15:36:31 -0700
    • Engine revision a5c24f538d
    • Dart version 3.3.2
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/hamza/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/hamza/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/hamza/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.14.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.87.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.84.0

[✓] Connected device (3 available)
    • iPhone 15 Pro Max (mobile) • A429608D-6879-4980-BD58-24268661A337 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
    • macOS (desktop)            • macos                                • darwin-arm64   • macOS 14.2.1 23C71
      darwin-arm64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 123.0.6312.58

[✓] Network resources
    • All expected network resources are available.

• No issues found!

该故障影响生产环境,急需解决,若需补充信息请告知。

内容的提问来源于stack exchange,提问作者Hamza

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 17:34:56