firebase / flutterfire

πŸ”₯ A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.6k stars 3.95k forks source link

πŸ› [firebase_analytics] Events not working with Name must start with a letter error #8097

Closed Ashkan4472 closed 2 years ago

Ashkan4472 commented 2 years ago

Bug report

Describe the bug after upgrading Kotlin version to latest(1.6.10) due to flutter needs, firebase analytics gives Name must start with a letter. Type, name: event param, 1.2.0 error and wont logs any event.

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` Doctor summary (to see all details, run flutter doctor -v): [βœ“] Flutter (Channel stable, 2.10.1, on Arch Linux 5.15.23-2-lts, locale en_US.UTF-8) [βœ“] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) [βœ—] Chrome - develop for the web (Cannot find Chrome executable at google-chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [βœ“] Android Studio [βœ“] Connected device (1 available) [βœ“] HTTP Host Availability ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 2.16.1 Flutter SDK 2.10.1 ninipaa 1.2.0+4010 dependencies: - android_intent_plus 3.1.1 [flutter platform meta] - chewie 1.2.2 [cupertino_icons flutter provider video_player wakelock] - cupertino_icons 1.0.4 - curved_navigation_bar 1.0.3 [flutter meta] - dio 4.0.4 [http_parser path] - firebase_analytics 9.1.0 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter] - firebase_core 1.12.0 [firebase_core_platform_interface firebase_core_web flutter meta] - flutter 0.0.0 [characters collection material_color_utilities meta typed_data vector_math sky_engine] - flutter_linear_datepicker 2.0.4 [flutter shamsi_date] - flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path typed_data vector_math] - flutter_switch 0.3.2 [flutter] - get 4.6.1 [flutter] - image_cropper 1.4.1 [flutter] - image_picker 0.8.4+8 [flutter flutter_plugin_android_lifecycle image_picker_for_web image_picker_platform_interface] - just_audio 0.9.20 [just_audio_platform_interface just_audio_web audio_session rxdart path path_provider async uuid crypto meta flutter] - marquee 2.2.1 [fading_edge_scrollview flutter] - pinput 1.2.2 [flutter] - shamsi_date 1.0.1 - share_plus 3.0.5 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows share_plus_web] - shared_preferences 2.0.13 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - shimmer 2.0.0 [flutter] - uni_links 0.5.1 [flutter uni_links_platform_interface uni_links_web] - url_launcher 6.0.20 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - video_player 2.2.18 [flutter video_player_android video_player_avfoundation video_player_platform_interface video_player_web html] dev dependencies: - flutter_launcher_icons 0.9.2 [args image path yaml] - flutter_lints 1.0.4 [lints] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph typed_data] transitive dependencies: - archive 3.2.0 [crypto path] - args 2.3.0 - async 2.8.2 [collection meta] - audio_session 0.1.6+1 [flutter flutter_web_plugins rxdart meta] - boolean_selector 2.1.0 [source_span string_scanner] - characters 1.2.0 - charcode 1.3.1 - clock 1.1.0 - collection 1.15.0 - cross_file 0.3.2 [flutter js meta] - crypto 3.0.1 [collection typed_data] - csslib 0.17.1 [source_span] - fading_edge_scrollview 2.0.1 [flutter] - fake_async 1.2.0 [clock collection] - ffi 1.1.2 - file 6.1.2 [meta path] - firebase_analytics_platform_interface 3.0.5 [firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.4.0+6 [firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - firebase_core_platform_interface 4.2.4 [collection flutter meta plugin_platform_interface] - firebase_core_web 1.5.4 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - flutter_plugin_android_lifecycle 2.0.5 [flutter] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta typed_data vector_math] - html 0.15.0 [csslib source_span] - http 0.13.4 [async http_parser meta path] - http_parser 4.0.0 [charcode collection source_span string_scanner typed_data] - image 3.1.1 [archive meta xml] - image_picker_for_web 2.1.5 [flutter flutter_web_plugins image_picker_platform_interface pedantic] - image_picker_platform_interface 2.4.3 [flutter http plugin_platform_interface cross_file] - intl 0.17.0 [clock path] - js 0.6.3 - just_audio_platform_interface 4.1.0 [flutter plugin_platform_interface] - just_audio_web 0.4.4 [just_audio_platform_interface flutter flutter_web_plugins] - lints 1.0.1 - matcher 0.12.11 [stack_trace] - material_color_utilities 0.1.3 - meta 1.7.0 - mime 1.0.1 - nested 1.0.0 [flutter] - path 1.8.0 - path_provider 2.0.9 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows] - path_provider_android 2.0.11 [flutter path_provider_platform_interface] - path_provider_ios 2.0.7 [flutter path_provider_platform_interface] - path_provider_linux 2.1.5 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_macos 2.0.5 [flutter path_provider_platform_interface] - path_provider_platform_interface 2.0.3 [flutter platform plugin_platform_interface] - path_provider_windows 2.0.5 [ffi flutter path path_provider_platform_interface win32] - pedantic 1.11.1 - petitparser 4.4.0 [meta] - platform 3.1.0 - plugin_platform_interface 2.1.2 [meta] - process 4.2.4 [file path platform] - provider 5.0.0 [collection flutter nested] - rxdart 0.27.3 - share_plus_linux 2.0.4 [share_plus_platform_interface file flutter meta url_launcher] - share_plus_macos 2.0.2 [share_plus_platform_interface flutter] - share_plus_platform_interface 2.0.1 [flutter meta mime plugin_platform_interface] - share_plus_web 2.0.4 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta] - share_plus_windows 2.0.3 [share_plus_platform_interface flutter meta url_launcher] - shared_preferences_android 2.0.11 [flutter shared_preferences_platform_interface] - shared_preferences_ios 2.0.10 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.1.0 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_macos 2.0.3 [flutter shared_preferences_platform_interface] - shared_preferences_platform_interface 2.0.0 [flutter] - shared_preferences_web 2.0.3 [flutter flutter_web_plugins shared_preferences_platform_interface] - shared_preferences_windows 2.1.0 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - sky_engine 0.0.99 - source_span 1.8.1 [collection path term_glyph] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - string_scanner 1.1.0 [charcode source_span] - term_glyph 1.2.0 - test_api 0.4.8 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - typed_data 1.3.0 [collection] - uni_links_platform_interface 1.0.0 [flutter plugin_platform_interface] - uni_links_web 0.1.0 [flutter flutter_web_plugins uni_links_platform_interface] - url_launcher_android 6.0.15 [flutter url_launcher_platform_interface] - url_launcher_ios 6.0.15 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.0 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.0 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.0.5 [flutter plugin_platform_interface] - url_launcher_web 2.0.8 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.0 [flutter url_launcher_platform_interface] - uuid 3.0.5 [crypto] - vector_math 2.1.1 - video_player_android 2.3.0 [flutter video_player_platform_interface] - video_player_avfoundation 2.3.0 [flutter video_player_platform_interface] - video_player_platform_interface 5.1.0 [flutter plugin_platform_interface] - video_player_web 2.0.7 [flutter flutter_web_plugins video_player_platform_interface] - wakelock 0.5.6 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web wakelock_windows] - wakelock_macos 0.4.0 [flutter flutter_web_plugins wakelock_platform_interface] - wakelock_platform_interface 0.3.0 [flutter meta] - wakelock_web 0.4.0 [flutter flutter_web_plugins js wakelock_platform_interface] - wakelock_windows 0.2.0 [flutter wakelock_platform_interface win32] - win32 2.4.0 [ffi] - xdg_directories 0.2.0+1 [meta path process] - xml 5.3.1 [collection meta petitparser] - yaml 3.1.0 [collection source_span string_scanner] ```

darshankawar commented 2 years ago

@Ashkan4472

Can you provide how are you passing analytics events ? Also please provide complete error log that contains the error you mentioned. Also, if you revert back to previous kotlin version, does the same event get logged ?

Ashkan4472 commented 2 years ago

Can you provide how are you passing analytics events ?

i used default events like logAppOpen (i created a util class with static functions as helpers)

  static Future<void> logOpenApp() async {
    if (Environment.useFirebase) {
      return FirebaseAnalytics.instance.logAppOpen();
    }
  }

Also please provide complete error log that contains the error you mentioned

unfortunately this is the only thing that logs nothing more (with -v flag too)

if you revert back to previous kotlin version, does the same event get logged

i couldn't do that as flutter 2.10 requires newer version of kotlin. i tested till 1.5.0 and error was same it is good to mention i don't know if this error is because of that or flutter 2.10 or something else but i know it happened after flutter upgrade

Ashkan4472 commented 2 years ago

rolling back to flutter 2.8.1 and kotlin 1.3.50, logs works

darshankawar commented 2 years ago

@Ashkan4472 With your current setting, ie, upgrade kotlin version and 2.10.1, can you try below and see if you still get same error ?

Future<void> _sendAnalyticsEvent() async {
    await widget.analytics.logEvent(
      name: 'test_event',
      parameters: <String, dynamic>{
        'string': 'string',
        'int': 42,
        'long': 12345678910,
        'double': 42.0,
        // Only strings and numbers (ints & doubles) are supported for GA custom event parameters:
        // https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets#overview
        'bool': true.toString(),
        'items': [itemCreator()]
      },
    );
    setMessage('logEvent succeeded');
  }
Ashkan4472 commented 2 years ago

@darshankawar i don't know what happended but as i rolled back to 2.10.1 and updated kotlin, no error has loged (event with default logs like app_open) but at the same time no event was logged in firebase analytics dashboard eather. i think it might log after some time or in release mode.

darshankawar commented 2 years ago

@Ashkan4472 Thanks for the update and sorry for coming back late on this. Based on your above comment, it seems not be the plugin issue, but probably takes a bit time to log properly specially in release mode. I suggest you to keep an eye on the pattern if you again see the same error as you reported originally.

google-oss-bot commented 2 years ago

Hey @Ashkan4472. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 2 years ago

Since there haven't been any recent updates here, I am going to close this issue.

@Ashkan4472 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.