Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Analytics] Recorded events not showing in Pinpoint #103

Closed
thomas-stockx opened this issue Sep 3, 2020 · 1 comment
Closed

[Analytics] Recorded events not showing in Pinpoint #103

thomas-stockx opened this issue Sep 3, 2020 · 1 comment

Comments

@thomas-stockx
Copy link

thomas-stockx commented Sep 3, 2020

Describe the bug
Hi, I've implemented Amplify Analytics next to the Firebase Analytics already in place in my current app.
Everything compiles and seems to work as expected on the mobile devices (both iOS and Android), but the analytics events recorded do not end up in the Pinpoint Console after waiting for > 12 hours, even when forcing a flush - again on both platforms.

I also don't seen any errors or issues in Logcat or xcode when recording the analytics event, so I'm not sure what the cause is.

To Reproduce
Init Amplify as documented (with amplifyconfig pointing to the amplifyconfig.dart generated by the Amplify CLI).
This is done during the splash screen of the app so it's configured as we finish loading into the actual app.

initAmplify() async {
    // Add Pinpoint and Cognito Plugins
    AmplifyAnalyticsPinpoint analyticsPlugin = AmplifyAnalyticsPinpoint();
    AmplifyAuthCognito authPlugin = AmplifyAuthCognito();
    amplifyInstance.addPlugin(
      analyticsPlugins: [analyticsPlugin],
      authPlugins: [authPlugin],
    );

    await amplifyInstance.configure(amplifyconfig);
  }

Recording a test event on a button press:

FlatButton(
    child: const Text('Amplify Log test_event'),
    onPressed: () async {
        AnalyticsEvent event = AnalyticsEvent('test_event');
        event.properties.addStringProperty('string', 'string');
        event.properties.addBoolProperty('bool', true);
        event.properties.addIntProperty('int', 42);
        event.properties.addDoubleProperty('double', 42.0);
        await Amplify.Analytics.recordEvent(event: event);
    },
),

Like the documentation specifies, the Auth Cognito plugin is added as well.
But as I'm not using Auth (yet), other than adding the plugin it is not touched in code.

As for the backend setup, everything seems to be in place on the AWS Amplify Console by having used amplify add analytics (which automatically added auth), and amplify push.

I've also tried doing amplify add auth first, and updating it afterwards by amplify add analytics, but that didn't seem to change anything (other than the auth setup having a project-specific name).

Expected behavior
Following the documentation for Analytics and recording an event should have it show up in the Pinpoint Console after a few minutes.

Screenshots
If applicable, add screenshots to help explain your problem.

Platform
Amplify Flutter current supports iOS and Android. This issue is reproducable in (check all that apply):
[X] Android
[X] iOS

Smartphone (please complete the following information):

  • Device: iPhone6, Pixel 4
  • OS: iOS 12.4.7, Android 11 Preview

Is there anything I'm missing from the documentation or is a delay of multiple hours expected?

Thanks!

@thomas-stockx thomas-stockx changed the title [Analytics] No events showing in Console, but no error logging on device [Analytics & Auth] Registered plugins "not added correctly" Sep 4, 2020
@thomas-stockx thomas-stockx changed the title [Analytics & Auth] Registered plugins "not added correctly" [Analytics] Recorded events not showing in Pinpoint Sep 4, 2020
@thomas-stockx
Copy link
Author

My bad!

Turns out I actually never called my initAmplify() as it got lost in a merge conflict.
Would it be possible to add extra error messaging to the Analytics package?
Implementing Auth (which also wasn't working) pointed me into the right direction as it clearly logged an error, while Analytics didn't log any errors or warnings.

2020-09-04 12:04:53.470 25611-25697 E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: Auth plugin not added correctly
    #0      AuthCategory.signIn (package:amplify_core_plugin_interface/amplify_auth_category.dart:40:72)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant