Skip to content

Google Play release bots trigger exceptions all over #6348

@jamilsaadeh97

Description

@jamilsaadeh97

Description

Whenever I upload a release build for my apps, I get bombarded with exceptions logged in Crashlytics.
This only happens on the Android release build. On iOS nothing is reported.

Those are the exceptions and stack traces reported:

Exception 1 - Occurs the most (30+ events reported for each release)

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Bad state: Too many elements
#00 (ListBase.singleWhere [list.dart:156]) (BuildId: xxx)
#01 (AuthCategory.getPlugin [amplify_auth_category.dart:47]) (BuildId: xxx)
#02 (AuthService.isLoggedIn [auth_service.dart:89]) (BuildId: xxx) 

The number 02 is my own class, the rest are Amplify's.
AuthService.isLoggedIn code:

  Future<bool> get isLoggedIn async {
    try {
      final session = await Amplify.Auth.getPlugin(
        AmplifyAuthCognito.pluginKey,
      ).fetchAuthSession();
      return session.isSignedIn;
    } on SignedOutException {
      return false;
    } on SessionExpiredException {
      return false;
    } on NetworkException {
      return true;
    } catch (error, stack) {
      ExceptionsController.log(error, stack);
      rethrow;
    }
  }

Exception 2 (~5 events each release)

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: PluginError {
  "message": "Auth plugin has not been added to Amplify",
  "recoverySuggestion": "Add Auth plugin to Amplify and call configure before calling Auth related APIs"
}
#00 (AmplifyCategory.defaultPlugin [amplify_categories.dart:87]) (BuildId: xxx)
#01 (AuthCategory.fetchAuthSession.<anonymous closure> [amplify_auth_category.dart:985]) (BuildId: xxx)
#02 (_rootRun [zone.dart:1525]) (BuildId: xxx)
#03 (_rootRun [zone.dart:1516]) (BuildId: xxx)
#04 (_CustomZone.run [zone.dart:1422]) (BuildId: xxx)
#05 (_runZoned [zone.dart:2034]) (BuildId: xxx)
#06 (runZoned [zone.dart:1960]) (BuildId: xxx)
#07 (identifyCall [amplify_category_method.dart:145]) (BuildId: xxx)
#08 (AuthCategory.fetchAuthSession [amplify_auth_category.dart:983]) (BuildId: xxx)
#09 (CognitoIamAuthProvider.retrieve [cognito_iam_auth_provider.dart:25]) (BuildId: xxx)
#10 (AWSSigV4Signer.sign.<anonymous closure> [aws_signer.dart:108]) (BuildId: xxx)
#11 (_rootRun [zone.dart:1525]) (BuildId: xxx)
#12 (_rootRun [zone.dart:1516]) (BuildId: xxx)
#13 (_CustomZone.run [zone.dart:1422]) (BuildId: xxx)
#14 (_runZoned [zone.dart:2034]) (BuildId: xxx)
#15 (runZoned [zone.dart:1960]) (BuildId: xxx)
#16 (signZoned [zone.dart:10]) (BuildId: xxx)
#17 (AWSSigV4Signer.sign [aws_signer.dart:107]) (BuildId: xxx)
#18 (WithSigV4.intercept [with_sig_v4.dart:45]) (BuildId: xxx)
#19 (SmithyHttpRequest.transformRequest [http_request.dart:138]) (BuildId: xxx)
#20 (SmithyHttpRequest.send.<anonymous closure> [http_request.dart:189]) (BuildId: xxx)

Exception 3 (~5 events each release)

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: PushNotificationException {
  "message": "Error occurred awaiting for device token.",
  "recoverySuggestion": "Review the underlying exception.",
  "underlyingException": "PlatformException(TOKEN_RECEIVED, java.util.concurrent.ExecutionException: java.io.IOException: TOO_MANY_REGISTRATIONS, null, null)"
}
#00 (AmplifyPushNotifications._registerDeviceWhenConfigure [amplify_push_notifications_impl.dart:349]) (BuildId: xxx )
#01 (AmplifyPushNotifications.configure [amplify_push_notifications_impl.dart:231]) (BuildId: xxx )
#02 (Future.wait.<anonymous closure> [future.dart:525]) (BuildId: xxx )
#03 (AmplifyClass._configurePlugins [amplify_class.dart:199]) (BuildId: xxx )
#04 (AmplifyClass.configure [amplify_class.dart:118]) (BuildId: xxx )
#05 (_InitializationState._configureAmplify [init_app.dart:90]) (BuildId: xxx )

The _InitializationState._configureAmplify function is the normal configure amplify function of the apps

Based on Crashlytics the devices where the exceptions were thrown are 70% OnePlus8Pro on Android 11 and 30% Google Pixel 6 Pro on Android 12.

This will become confusing if a real user has those exceptions because I won't be able to differentiate between the bots and the real users. Also the Google Play bots can be ran randomly at any day as part of Google's check policy so it won't be always on a release date.

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

  1. Configure Amplify and Crashlytics (or other tools for reporting)
  2. Release android app and wait for the Google bots to run.

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.35.3

Amplify Flutter Version

2.6.5

Deployment Method

Amplify CLI (Gen 1)

Schema

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreIssues related to the Amplify Core PluginquestionA question about the Amplify Flutter libraries

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions