aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.31k stars 241 forks source link

Amplify Analytics Events logged to pinpoint do not appear #2478

Closed Stivenmore closed 1 year ago

Stivenmore commented 1 year ago

Description

Custom events logged to pinpoint do not appear. No errors are thrown and Amplify is correctly being configured. I am using Cognito, storage_s3, amplify_api.

Categories

Steps to Reproduce

  1. Create a flutter project.
  2. When the user is at home, I use a logic for time tracking in the app, it is made with a pad.
  3. When the app enters the on Pause state, it sends the information to the pinpoint.

It does not show an error or anything like that, but the events are not reflected either.

Screenshots

No response

Platforms

Android Device/Emulator API Level

No response

Environment

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.7, on Microsoft Windows [Versi¢n 10.0.22621.819], locale es-CO)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.6)
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.74.0)
[√] Connected device (4 available)
[√] HTTP Host Availability

• No issues found!

Dependencies

dependencies:
- amplify_analytics_pinpoint 0.6.10 [amplify_analytics_pinpoint_android amplify_analytics_pinpoint_ios amplify_core aws_common flutter meta]
- amplify_api 0.6.10 [amplify_api_android amplify_api_ios amplify_core amplify_flutter aws_common collection flutter meta plugin_platform_interface]
- amplify_auth_cognito 0.6.10 [amplify_auth_cognito_android amplify_auth_cognito_ios amplify_core aws_common collection flutter meta plugin_platform_interface]
- amplify_authenticator 0.2.4 [amplify_auth_cognito amplify_core amplify_flutter async aws_common collection flutter flutter_localizations intl stream_transform]
- amplify_flutter 0.6.10 [amplify_core amplify_datastore_plugin_interface amplify_flutter_android amplify_flutter_ios aws_common collection flutter meta plugin_platform_interface]
- amplify_storage_s3 0.6.10 [amplify_storage_s3_android amplify_storage_s3_ios amplify_core aws_common flutter meta plugin_platform_interface path_provider path]
- bloc 8.1.0 [meta]
- bloc_concurrency 0.2.0 [bloc stream_transform]
- camera 0.10.0+4 [camera_android camera_avfoundation camera_platform_interface camera_web flutter flutter_plugin_android_lifecycle quiver]
- cupertino_icons 1.0.5
- email_validator 2.1.17
- equatable 2.0.5 [collection meta]
- fl_chart 0.55.2 [flutter equatable]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_bloc 8.1.1 [flutter bloc provider]
- flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]
- flutter_native_splash 2.2.14 [args flutter flutter_web_plugins js html image meta path universal_io xml yaml]
- google_fonts 3.0.1 [flutter http path_provider crypto]
- http 0.13.5 [async http_parser meta path]
- infinite_scroll_pagination 3.2.0 [flutter sliver_tools]
- intl 0.17.0 [clock path]
- intl_phone_number_input 0.7.1 [flutter libphonenumber_plugin equatable collection]
- json_annotation 4.7.0 [meta]
- jwt_decoder 2.0.1
- local_auth 2.1.2 [flutter intl local_auth_android local_auth_ios local_auth_platform_interface local_auth_windows]
- lottie 2.0.0 [archive flutter path vector_math]
- path 1.8.2
- path_provider 2.0.11 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- pinput 2.2.16 [flutter smart_auth]
- rive 0.9.1 [collection flutter graphs http meta]
- rxdart 0.27.7
- scrollable_positioned_list 0.3.5 [flutter collection]
- shared_preferences 2.0.15 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- web3dart 2.4.1 [pointycastle http uuid json_rpc_2 stream_transform stream_channel eip55 collection typed_data convert async]
- webview_flutter 3.0.4 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview]       

transitive dependencies:
- amplify_analytics_pinpoint_android 0.6.10 [flutter]
- amplify_analytics_pinpoint_ios 0.6.10 [flutter]
- amplify_api_android 0.6.10 [flutter]
- amplify_api_ios 0.6.10 [amplify_core flutter]
- amplify_auth_cognito_android 0.6.10 [flutter]
- amplify_auth_cognito_ios 0.6.10 [amplify_core flutter]
- amplify_core 0.6.10 [aws_common collection flutter intl json_annotation meta plugin_platform_interface uuid]
- amplify_datastore_plugin_interface 0.6.10 [amplify_core collection flutter meta]
- amplify_flutter_android 0.6.10 [flutter]
- amplify_flutter_ios 0.6.10 [amplify_core flutter]
- amplify_storage_s3_android 0.6.10 [flutter]
- amplify_storage_s3_ios 0.6.10 [flutter]
- archive 3.3.4 [crypto path pointycastle]
- args 2.3.1
- async 2.9.0 [collection meta]
- aws_common 0.1.1 [async collection http meta stream_transform uuid]
- camera_android 0.10.0+4 [camera_platform_interface flutter flutter_plugin_android_lifecycle stream_transform]
- camera_avfoundation 0.9.8+6 [camera_platform_interface flutter stream_transform]
- camera_platform_interface 2.3.0 [cross_file flutter plugin_platform_interface stream_transform]
- camera_web 0.3.0+1 [camera_platform_interface flutter flutter_web_plugins stream_transform]
- characters 1.2.1
- clock 1.1.1
- collection 1.16.0
- convert 3.1.1 [typed_data]
- cross_file 0.3.3+2 [js meta]
- crypto 3.0.2 [typed_data]
- csslib 0.17.2 [source_span]
- eip55 1.0.2 [pointycastle]
- ffi 2.0.1
- file 6.1.4 [meta path]
- flutter_plugin_android_lifecycle 2.0.7 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- graphs 2.2.0 [collection]
- html 0.15.1 [csslib source_span]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- image 3.2.2 [archive meta xml]
- js 0.6.4
- json_rpc_2 3.0.2 [stack_trace stream_channel]
- libphonenumber 2.0.2 [flutter meta]
- libphonenumber_platform_interface 0.3.1 [flutter plugin_platform_interface]
- libphonenumber_plugin 0.2.3 [flutter flutter_web_plugins libphonenumber_platform_interface libphonenumber_web libphonenumber]
- libphonenumber_web 0.2.0+1 [flutter flutter_web_plugins js libphonenumber_platform_interface]
- local_auth_android 1.0.15 [flutter flutter_plugin_android_lifecycle intl local_auth_platform_interface]
- local_auth_ios 1.0.10 [flutter intl local_auth_platform_interface]
- local_auth_platform_interface 1.0.5 [flutter intl plugin_platform_interface]
- local_auth_windows 1.0.4 [flutter local_auth_platform_interface]
- matcher 0.12.12 [stack_trace]
- material_color_utilities 0.1.5
- meta 1.8.0
- nested 1.0.0 [flutter]
- path_provider_android 2.0.21 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.11 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.7 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.6 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.5 [flutter platform plugin_platform_interface]
- path_provider_windows 2.1.3 [ffi flutter path path_provider_platform_interface win32]
- petitparser 5.1.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.1.3 [meta]
- pointycastle 3.6.2 [collection convert js]
- process 4.2.4 [file path platform]
- provider 6.0.4 [collection flutter nested]
- quiver 3.1.0 [matcher]
- shared_preferences_android 2.0.14 [flutter shared_preferences_platform_interface]
- shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.1.0 [flutter plugin_platform_interface]
- shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface]
- shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- sky_engine 0.0.99
- sliver_tools 0.2.8 [flutter]
- smart_auth 1.0.6 [flutter flutter_web_plugins]
- source_span 1.9.0 [collection path term_glyph]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- stream_transform 2.1.0
- string_scanner 1.1.1 [source_span]
- term_glyph 1.2.1
- typed_data 1.3.1 [collection]
- universal_io 2.0.4 [collection crypto meta typed_data]
- uuid 3.0.6 [crypto]
- vector_math 2.1.2
- webview_flutter_android 2.10.4 [flutter webview_flutter_platform_interface]
- webview_flutter_platform_interface 1.9.5 [flutter meta plugin_platform_interface]
- webview_flutter_wkwebview 2.9.5 [flutter path webview_flutter_platform_interface]
- win32 3.1.1 [ffi]
- xdg_directories 0.2.0+2 [meta path process]

Device

Xiaomi Redmi Note 8

OS

Windows 11

Deployment Method

Amplify CLI

CLI Version

2.0

Additional Context

No response

Amplify Config

const awsGlobalConfig = { 'UserAgent': 'aws-amplify-cli/2.0', 'Version': '1.0', ...authConfig, ...apiConfig, ...storageConfig, ...analyticsConfig, };

const authConfig = { 'auth': { 'plugins': { 'awsCognitoAuthPlugin': { 'IdentityManager': {'Default': {}}, 'CredentialsProvider': { 'CognitoIdentity': { 'Default': { 'PoolId': Environment.awsIdentityPoolId, 'Region': Environment.awsRegion, } } }, 'CognitoUserPool': { 'Default': { 'PoolId': Environment.awsPoolId, 'AppClientId': Environment.awsPoolClientId, 'Region': Environment.awsRegion } }, 'Auth': { 'Default': { 'authenticationFlowType': 'USER_SRP_AUTH', 'socialProviders': [], 'usernameAttributes': ['EMAIL'], 'signupAttributes': ['EMAIL', 'SMS'], 'passwordProtectionSettings': { 'passwordPolicyMinLength': 8, 'passwordPolicyCharacters': [] }, 'mfaConfiguration': 'ON', 'mfaTypes': ['SMS'], 'verificationMechanisms': ['EMAIL'] } }, } } } };

const apiConfig = { 'api': { 'plugins': { 'awsAPIPlugin': { 'apix': { 'endpointType': 'GraphQL', 'endpoint': Environment.awsGraphqlEndpoint, 'region': Environment.awsRegion, 'authorizationType': 'AMAZON_COGNITO_USER_POOLS', } } } } };

const storageConfig = { 'storage': { 'plugins': { 'awsS3StoragePlugin': { 'bucket': Environment.awsBucketS3, 'region': Environment.awsRegion } } } };

const analyticsConfig = { 'analytics': { 'plugins': { 'awsPinpointAnalyticsPlugin': { 'pinpointAnalytics': { 'appId': Environment.awsPinpointIdProject, 'region': Environment.awsRegion, }, 'pinpointTargeting': { 'region': Environment.awsRegion, }, 'autoFlushEventsInterval': 10000 } } } };

fjnoyp commented 1 year ago

Hey @Stivenmore thanks for posting this issue.

Let's clarify these points so we can help you better:

1) Can you please confirm you are using 0.6.1 and not the next version of Amplify (ie. ^1.0.0-next.1)

2) Can you please provide code snippets of you sending the event. Also how do you send the event in relation to the app onPause?

3) In your tests do you run the app after the pause state. The app must be unpaused for events to be sent.

4) Have you tried sending custom events with a simple case, like calling Amplify.recordEvent when your app first starts up?

5) Lastly you said you have the issue on iOS and Android but you also mention Windows 11 as a device. Is that a typo or are you on the next version of Amplify testing on Windows platform as well?

flushEvents is needed for your events to be sent to Pinpoint. This is called automatically every 10/15 seconds but you can call it manually as well.

Jordan-Nelson commented 1 year ago

Hi @Stivenmore - Have you had a chance to look at the questions above?

fjnoyp commented 1 year ago

Hi @Stivenmore - Do you have any updates for this issue?