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

🐛 [firebase_messaging] Remote message cannot be cast to a map #4849

Closed
DeanPack opened this issue Jan 29, 2021 · 2 comments
Closed

🐛 [firebase_messaging] Remote message cannot be cast to a map #4849

DeanPack opened this issue Jan 29, 2021 · 2 comments
Labels
plugin: messaging type: bug Something isn't working

Comments

@DeanPack
Copy link

DeanPack commented Jan 29, 2021

Bug report

Describe the bug
I have discovered this bug report from firebase crashlytics. I've recently upgraded my app to use firebase messaging 8.0.0-dev.14. this fixed a lot of the crashes I once had on my app but introduced a couple of new ones. One of them is a class cast exception on the RemoteMessage object that was introduced in this new firebase version. I'm not sure how it is happening, but from looking through the function logs it is mostly all from when people try entering the app from a notification. This works fine every time for me and for most of my users, but I'm up to 22 crashes on my new version and the number keeps rising, so for some reason it is affecting some users, but not the vast majority.

Additional context

here are the crashlytics logs

RUNTIME LOGS
Fatal Exception: java.lang.RuntimeException: Unable to start receiver io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingReceiver: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Object[]
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:4005)
       at android.app.ActivityThread.access$2300(ActivityThread.java:273)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2050)
       at android.os.Handler.dispatchMessage(Handler.java:112)
       at android.os.Looper.loop(Looper.java:216)
       at android.app.ActivityThread.main(ActivityThread.java:7625)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
 CLASS EXCEPTION LOGS
       Caused by java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Object[]
       at androidx.collection.SimpleArrayMap.allocArrays(SimpleArrayMap.java:60)
       at androidx.collection.SimpleArrayMap.put(SimpleArrayMap.java:58)
       at com.google.firebase.messaging.Constants$MessagePayloadKeys.extractDeveloperDefinedPayload(Constants.java:75)
       at com.google.firebase.messaging.RemoteMessage.getData(RemoteMessage.java:6)
       at io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingUtils.remoteMessageToMap(FlutterFirebaseMessagingUtils.java:85)
       at io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingStore.storeFirebaseMessage(FlutterFirebaseMessagingStore.java:2)
       at io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingReceiver.onReceive(FlutterFirebaseMessagingReceiver.java:48)
       at android.app.ActivityThread.handleReceiver(ActivityThread.java:3996)
       at android.app.ActivityThread.access$2300(ActivityThread.java:273)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2050)
       at android.os.Handler.dispatchMessage(Handler.java:112)
       at android.os.Looper.loop(Looper.java:216)
       at android.app.ActivityThread.main(ActivityThread.java:7625)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

Flutter doctor

Run flutter doctor and paste the output below:

flutter doctor
[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-US)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
[✓] Android Studio (version 3.4)
[✓] VS Code (version 1.52.1)
[✓] Connected device (1 available)

• No issues found!

Flutter dependencies

flutter pub deps -- --style=compact
dependencies:
- agora_rtc_engine 3.2.1 [flutter flutter_web_plugins json_annotation]
- app_review 2.0.1 [http intl package_info url_launcher flutter]
- apple_sign_in 0.1.0 [flutter]
- audio_recorder 0.0.6 [path flutter path_provider file]
- audio_service 0.16.1 [audio_session rxdart flutter_isolate flutter_cache_manager sqflite js flutter flutter_web_plugins]
- audioplayer 0.5.2 [flutter]
- built_collection 4.3.2 [collection quiver]
- built_value 7.1.0 [built_collection collection fixnum quiver]
- cached_network_image 2.3.3 [flutter flutter_cache_manager octo_image]
- camera 0.5.8+11 [flutter]
- carousel_slider 2.3.1 [flutter]
- chewie 0.10.4 [video_player cupertino_icons wakelock flutter]
- cloud_firestore 0.16.0 [flutter meta quiver firebase_core firebase_core_platform_interface cloud_firestore_platform_interface cloud_firestore_web]
- cloud_functions 0.9.0 [meta flutter firebase_core firebase_core_platform_interface cloud_functions_platform_interface cloud_functions_web]
- connectivity 2.0.2 [flutter meta connectivity_platform_interface connectivity_macos connectivity_for_web]
- contacts_service 0.4.6 [flutter collection quiver]
- cupertino_icons 1.0.0
- devicelocale 0.3.3 [flutter]
- dots_indicator 1.2.0 [flutter]
- downloads_path_provider 0.1.0 [flutter]
- dynamic_theme 1.0.1 [flutter shared_preferences]
- facebook_standard_events 0.0.1 [flutter]
- file_picker 2.1.0 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface]
- firebase_analytics 7.0.1 [meta flutter firebase_core firebase_analytics_web firebase_analytics_platform_interface]
- firebase_auth 0.20.0 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter]
- firebase_core 0.7.0 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_crashlytics 0.4.0+1 [flutter stack_trace firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface]
- firebase_database 6.0.0 [flutter firebase_core]
- firebase_dynamic_links 0.7.0+1 [flutter firebase_core]
- firebase_messaging 8.0.0-dev.14 [meta flutter firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web]
- firebase_remote_config 0.6.0 [flutter firebase_core]
- firebase_storage 7.0.0 [flutter firebase_core firebase_core_platform_interface firebase_storage_web firebase_storage_platform_interface quiver]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_app_badger 1.1.2 [flutter]
- flutter_colorpicker 0.3.4 [flutter]
- flutter_cupertino_date_picker 1.0.26+2 [flutter]
- flutter_cupertino_localizations 1.0.1 [flutter flutter_localizations]
- flutter_downloader 1.5.2 [flutter]
- flutter_keyboard_visibility 3.2.2 [flutter]
- flutter_linkify 4.0.2 [flutter linkify]
- flutter_localizations 0.0.0 [flutter intl characters collection meta path typed_data vector_math]
- flutter_native_image 0.0.5+2 [flutter]
- flutter_parsed_text 1.2.5 [flutter]
- flutter_redux 0.7.0 [meta redux flutter]
- flutter_slidable 0.5.7 [flutter]
- flutter_sms 2.1.1 [flutter url_launcher flutter_web_plugins plugin_platform_interface flutter_user_agent]
- flutter_staggered_grid_view 0.3.2 [flutter]
- flutter_sticky_header 0.4.6 [flutter value_layout_builder]
- flutter_svg 0.19.1 [flutter meta path_drawing vector_math xml]
- flutter_time_picker_spinner 1.0.6+1 [flutter]
- flutter_webview_plugin 0.3.11 [flutter]
- fluttertoast 7.1.1 [flutter flutter_web_plugins]
- geocoding 1.0.5 [flutter geocoding_platform_interface url_launcher]
- geolocator 6.1.7 [flutter geolocator_platform_interface]
- get_ip 0.4.0 [flutter]
- google_sign_in 4.5.6 [google_sign_in_platform_interface flutter meta google_sign_in_web]
- grouped_list 3.7.1 [flutter]
- http 0.12.2 [http_parser path pedantic]
- image_cropper 1.3.1 [flutter]
- image_downloader 0.20.0 [flutter]
- image_picker 0.6.7+14 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- in_app_purchase 0.3.4+16 [async collection flutter json_annotation meta]
- intl 0.16.1 [path]
- m3u 1.0.3 [meta]
- native_screenshot 0.0.4 [flutter]
- overlay_support 1.0.5 [flutter async]
- package_info 0.4.3+2 [flutter]
- page_transition 1.1.7+6 [flutter]
- path_provider 1.6.24 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- permission_handler 5.0.1+1 [flutter meta permission_handler_platform_interface]
- photo_view 0.10.3 [flutter]
- provider 4.3.2+2 [flutter nested collection]
- redux 4.0.0+3
- redux_dev_tools 0.5.2 [redux]
- redux_epics 0.14.0 [rxdart redux]
- redux_logging 0.4.0 [redux logging]
- redux_thunk 0.3.0 [redux]
- rxdart 0.24.1
- save_in_gallery 0.1.3 [flutter]
- scoped_model 1.1.0 [flutter]
- sentry 3.0.1 [http meta stack_trace usage pedantic]
- share 0.6.5+4 [meta mime flutter]
- shimmer 1.1.2 [flutter]
- showcaseview 0.1.6 [flutter]
- simple_pdf_viewer 0.2.2 [flutter webview_flutter]
- streaming_shared_preferences 1.0.1 [flutter shared_preferences meta]
- stripe_payment 1.0.8 [flutter]
- timeago 2.0.28
- trust_fall 1.0.4 [flutter]
- url_launcher 5.7.10 [flutter url_launcher_platform_interface url_launcher_web url_launcher_linux url_launcher_macos url_launcher_windows]
- uuid 2.2.2 [crypto convert]
- vibration 1.7.2 [flutter vibration_web]
- video_player 1.0.1 [meta video_player_platform_interface video_player_web flutter]
- wakelock 0.2.1+1 [flutter meta wakelock_platform_interface wakelock_web]
- web_socket_channel 1.1.0 [async crypto stream_channel]

dev dependencies:
- build_runner 1.10.2 [args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style glob graphs http_multi_server io js logging meta mime path pedantic pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml]
- built_value_generator 7.1.0 [analyzer build build_config built_collection built_value source_gen quiver]
- flutter_launcher_icons 0.7.5 [image args yaml]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]
- intl_translation 0.17.10+1 [analyzer args dart_style intl path petitparser]

transitive dependencies:
- _fe_analyzer_shared 7.0.0 [meta]
- analyzer 0.39.17 [_fe_analyzer_shared args charcode cli_util collection convert crypto glob html meta package_config path pub_semver source_span watcher yaml]
- archive 2.0.13 [crypto args path]
- args 1.6.0
- async 2.5.0-nullsafety.1 [collection]
- audio_session 0.0.10 [flutter flutter_web_plugins rxdart]
- boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner]
- build 1.3.0 [analyzer async convert crypto logging meta path glob]
- build_config 0.4.2 [checked_yaml json_annotation meta path pubspec_parse yaml]
- build_daemon 2.1.4 [built_collection built_value http_multi_server logging pedantic path pool shelf shelf_web_socket stream_transform watcher web_socket_channel]
- build_resolvers 1.3.11 [analyzer build crypto graphs logging path package_config pub_semver]
- build_runner_core 6.0.1 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pedantic pool timing watcher yaml]
- characters 1.1.0-nullsafety.3
- charcode 1.2.0-nullsafety.1
- checked_yaml 1.0.2 [json_annotation source_span yaml]
- cli_util 0.2.0 [path]
- clock 1.1.0-nullsafety.1
- cloud_firestore_platform_interface 3.0.1 [flutter meta collection firebase_core plugin_platform_interface]
- cloud_firestore_web 0.3.0+1 [flutter flutter_web_plugins http_parser meta firebase_core firebase_core_web cloud_firestore_platform_interface js]
- cloud_functions_platform_interface 4.0.1 [flutter meta firebase_core plugin_platform_interface]
- cloud_functions_web 3.1.3 [firebase_core firebase_core_web cloud_functions_platform_interface flutter flutter_web_plugins http_parser meta js]
- code_builder 3.5.0 [built_collection built_value collection matcher meta]
- collection 1.15.0-nullsafety.3
- connectivity_for_web 0.3.1+4 [connectivity_platform_interface flutter_web_plugins flutter]
- connectivity_macos 0.1.0+7 [flutter]
- connectivity_platform_interface 1.0.6 [flutter meta plugin_platform_interface]
- convert 2.1.1 [charcode typed_data]
- crypto 2.1.5 [collection convert typed_data]
- csslib 0.16.2 [source_span]
- dart_style 1.3.6 [analyzer args path source_span]
- fake_async 1.2.0-nullsafety.1 [clock collection]
- ffi 0.1.3
- file 5.2.1 [intl meta path]
- firebase 7.3.2 [http http_parser js]
- firebase_analytics_platform_interface 1.0.3 [flutter meta]
- firebase_analytics_web 0.1.1 [flutter flutter_web_plugins firebase firebase_analytics_platform_interface meta]
- firebase_auth_platform_interface 3.0.1 [flutter meta firebase_core plugin_platform_interface]
- firebase_auth_web 0.3.2+6 [flutter flutter_web_plugins meta http_parser intl firebase_core firebase_core_web firebase_auth_platform_interface js]
- firebase_core_platform_interface 3.0.1 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.1+3 [firebase_core_platform_interface flutter flutter_web_plugins meta js]
- firebase_crashlytics_platform_interface 1.1.6 [flutter meta collection firebase_core plugin_platform_interface]
- firebase_messaging_platform_interface 1.0.0-dev.10 [flutter meta firebase_core plugin_platform_interface]
- firebase_messaging_web 0.1.0-dev.5 [flutter flutter_web_plugins meta firebase_core firebase_core_web firebase_messaging_platform_interface js service_worker]
- firebase_storage_platform_interface 1.0.4 [flutter meta collection firebase_core plugin_platform_interface]
- firebase_storage_web 0.1.1+3 [async crypto firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta]
- fixnum 0.10.11
- flutter_blurhash 0.5.0 [flutter meta]
- flutter_cache_manager 2.0.0 [flutter path_provider uuid http path sqflite pedantic clock file rxdart]
- flutter_isolate 1.0.0+14 [flutter uuid]
- flutter_plugin_android_lifecycle 1.0.11 [flutter]
- flutter_user_agent 1.2.2 [flutter]
- flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math]
- geocoding_platform_interface 1.0.1+1 [flutter meta plugin_platform_interface]
- geolocator_platform_interface 1.0.8 [flutter meta plugin_platform_interface vector_math]
- glob 1.2.0 [async collection node_io path pedantic string_scanner]
- google_sign_in_platform_interface 1.1.2 [flutter meta quiver]
- google_sign_in_web 0.9.2 [google_sign_in_platform_interface flutter flutter_web_plugins meta js]
- graphs 0.2.0
- html 0.14.0+4 [csslib source_span]
- http_multi_server 2.2.0 [async]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- image 2.1.19 [archive xml meta]
- image_picker_platform_interface 1.1.1 [flutter meta http plugin_platform_interface]
- import_js_library 1.0.2 [flutter html flutter_web_plugins js]
- io 0.3.4 [charcode meta path string_scanner]
- js 0.6.2
- json_annotation 3.1.1
- linkify 3.0.0
- logging 0.11.4
- matcher 0.12.10-nullsafety.1 [stack_trace]
- meta 1.3.0-nullsafety.3
- mime 0.9.7
- nested 0.0.4 [flutter]
- node_interop 1.2.0 [js]
- node_io 1.1.1 [node_interop path]
- octo_image 0.3.0 [flutter flutter_blurhash]
- package_config 1.9.3 [path charcode]
- path 1.8.0-nullsafety.1
- path_drawing 0.4.1+1 [vector_math meta path_parsing flutter]
- path_parsing 0.1.4 [vector_math meta]
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 0.0.4+6 [flutter]
- path_provider_platform_interface 1.0.4 [flutter meta platform plugin_platform_interface]
- path_provider_windows 0.0.4+3 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.9.2 [meta]
- permission_handler_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- petitparser 3.1.0 [meta]
- platform 2.2.1
- plugin_platform_interface 1.0.3 [meta]
- pool 1.4.0 [async stack_trace]
- process 3.0.13 [file intl meta path platform]
- pub_semver 1.4.4 [collection]
- pubspec_parse 0.1.5 [checked_yaml json_annotation pub_semver yaml]
- quiver 2.1.5 [matcher meta]
- service_worker 0.2.4 [js]
- shared_preferences 0.5.12+4 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows]
- shared_preferences_linux 0.0.2+4 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 0.0.1+11 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 1.0.4 [meta flutter]
- shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- shared_preferences_windows 0.0.1+3 [shared_preferences_platform_interface flutter ffi file meta path path_provider_platform_interface path_provider_windows]
- shelf 0.7.9 [async collection http_parser path stack_trace stream_channel]
- shelf_web_socket 0.2.3 [shelf web_socket_channel stream_channel]
- sky_engine 0.0.99
- source_gen 0.9.7+1 [analyzer async build dart_style glob meta path pedantic source_span]
- source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph]
- sqflite 1.3.2+1 [flutter sqflite_common path]
- sqflite_common 1.0.2+1 [synchronized path meta]
- stack_trace 1.10.0-nullsafety.1 [path]
- stream_channel 2.1.0-nullsafety.1 [async]
- stream_transform 1.2.0
- string_scanner 1.1.0-nullsafety.1 [charcode source_span]
- synchronized 2.2.0+2
- term_glyph 1.2.0-nullsafety.1
- test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- timing 0.1.1+2 [json_annotation]
- typed_data 1.3.0-nullsafety.3 [collection]
- url_launcher_linux 0.0.1+4 [flutter]
- url_launcher_macos 0.0.1+9 [flutter]
- url_launcher_platform_interface 1.0.9 [flutter meta plugin_platform_interface]
- url_launcher_web 0.1.5+1 [url_launcher_platform_interface flutter flutter_web_plugins meta]
- url_launcher_windows 0.0.1+3 [flutter]
- usage 3.4.2 [path]
- value_layout_builder 0.1.0 [flutter]
- vector_math 2.1.0-nullsafety.3
- vibration_web 1.6.2 [flutter flutter_web_plugins]
- video_player_platform_interface 2.2.0 [flutter meta]
- video_player_web 0.1.4+1 [flutter flutter_web_plugins meta video_player_platform_interface]
- wakelock_platform_interface 0.1.0+1 [flutter meta]
- wakelock_web 0.1.0+3 [flutter flutter_web_plugins import_js_library js wakelock_platform_interface]
- watcher 0.9.7+15 [async path pedantic]
- webview_flutter 0.3.24 [flutter]
- win32 1.7.4 [ffi]
- xdg_directories 0.1.2 [meta path process]
- xml 4.5.1 [collection convert meta petitparser]
- yaml 2.2.1 [charcode collection string_scanner source_span]
@DeanPack DeanPack added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Jan 29, 2021
@markusaksli-nc markusaksli-nc added plugin: messaging and removed Needs Attention This issue needs maintainer attention. labels Jan 29, 2021
@russellwheatley
Copy link
Member

Hey @DeanPack, is this still an issue? Have you tried the latest version firebase_messaging: "^10.0.3"?

@russellwheatley
Copy link
Member

Closing due to inactivity, will reopen if it is still an issue.

@firebase firebase locked and limited conversation to collaborators Nov 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin: messaging type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants