Bug report
firebase_messaging example application crashes when run in web.
% flutter run -d chrome
Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome... 11.1s
This app is linked to the debug service: ws://127.0.0.1:62922/x--MLTMd8yc=/ws
Debug service listening on ws://127.0.0.1:62922/x--MLTMd8yc=/ws
💪 Running with sound null safety 💪
🔥 To hot restart changes while running, press "r" or "R".
For a more detailed help message, press "h". To quit, press "q".
An Observatory debugger and profiler on Chrome is available at: http://127.0.0.1:62922/x--MLTMd8yc=
TypeError: Cannot read properties of undefined (reading 'messaging')
at new firebase_messaging_web.FirebaseMessagingWeb.new
(http://localhost:62880/packages/firebase_messaging_web/firebase_messaging_web.dart.lib.js:145:31)
at Function.registerWith
(http://localhost:62880/packages/firebase_messaging_web/firebase_messaging_web.dart.lib.js:50:73)
at Object.registerPlugins
(http://localhost:62880/packages/firebase_messaging_example/generated_plugin_registrant.dart.lib.js:15:49)
at main (http://localhost:62880/web_entrypoint.dart.lib.js:32:35)
at main.next (<anonymous>)
at runBody (http://localhost:62880/dart_sdk.js:38659:34)
at Object._async [as async] (http://localhost:62880/dart_sdk.js:38690:7)
at main$ (http://localhost:62880/web_entrypoint.dart.lib.js:31:18)
at http://localhost:62880/main_module.bootstrap.js:19:10
at Array.forEach (<anonymous>)
at window.$dartRunMain (http://localhost:62880/main_module.bootstrap.js:18:32)
at <anonymous>:1:8
at Object.runMain (http://localhost:62880/dwds/src/injected/client.js:8452:21)
at http://localhost:62880/dwds/src/injected/client.js:24130:19
at _wrapJsFunctionForAsync_closure.$protected (http://localhost:62880/dwds/src/injected/client.js:4461:15)
at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:62880/dwds/src/injected/client.js:11511:12)
at Object._asyncStartSync (http://localhost:62880/dwds/src/injected/client.js:4425:20)
at main__closure3.$call$body$main__closure (http://localhost:62880/dwds/src/injected/client.js:24142:16)
at main__closure3.call$1 (http://localhost:62880/dwds/src/injected/client.js:24069:19)
at StaticClosure._rootRunUnary (http://localhost:62880/dwds/src/injected/client.js:4823:18)
at _CustomZone.runUnary$2$2 (http://localhost:62880/dwds/src/injected/client.js:12879:39)
at _CustomZone.runUnaryGuarded$1$2 (http://localhost:62880/dwds/src/injected/client.js:12826:14)
at _ForwardingStreamSubscription._sendData$1 (http://localhost:62880/dwds/src/injected/client.js:12416:19)
at _ForwardingStreamSubscription._add$1 (http://localhost:62880/dwds/src/injected/client.js:12362:15)
at _ForwardingStreamSubscription._add$1 (http://localhost:62880/dwds/src/injected/client.js:12695:12)
at _MapStream._handleData$2 (http://localhost:62880/dwds/src/injected/client.js:12756:12)
at _ForwardingStreamSubscription._handleData$1 (http://localhost:62880/dwds/src/injected/client.js:12721:20)
at Object.eval (eval at Closure_forwardCallTo (http://localhost:62880/dwds/src/injected/client.js:1701:14),
<anonymous>:3:44)
at StaticClosure._rootRunUnary (http://localhost:62880/dwds/src/injected/client.js:4823:18)
at _CustomZone.runUnary$2$2 (http://localhost:62880/dwds/src/injected/client.js:12879:39)
at _CustomZone.runUnaryGuarded$1$2 (http://localhost:62880/dwds/src/injected/client.js:12826:14)
at _ControllerSubscription._sendData$1 (http://localhost:62880/dwds/src/injected/client.js:12416:19)
at _ControllerSubscription._add$1 (http://localhost:62880/dwds/src/injected/client.js:12362:15)
at _SyncStreamController._sendData$1 (http://localhost:62880/dwds/src/injected/client.js:12201:32)
at _SyncStreamController.add$1 (http://localhost:62880/dwds/src/injected/client.js:12082:15)
at Object.eval (eval at Closure_forwardInterceptedCallTo
(http://localhost:62880/dwds/src/injected/client.js:1781:14), <anonymous>:3:45)
at StaticClosure._rootRunUnary (http://localhost:62880/dwds/src/injected/client.js:4823:18)
at _CustomZone.runUnary$2$2 (http://localhost:62880/dwds/src/injected/client.js:12879:39)
at _CustomZone.runUnaryGuarded$1$2 (http://localhost:62880/dwds/src/injected/client.js:12826:14)
at _ControllerSubscription._sendData$1 (http://localhost:62880/dwds/src/injected/client.js:12416:19)
at _ControllerSubscription._add$1 (http://localhost:62880/dwds/src/injected/client.js:12362:15)
at _SyncStreamController._sendData$1 (http://localhost:62880/dwds/src/injected/client.js:12201:32)
at _SyncStreamController.add$1 (http://localhost:62880/dwds/src/injected/client.js:12082:15)
at _GuaranteeSink.add$1 (http://localhost:62880/dwds/src/injected/client.js:23581:25)
at HtmlWebSocketChannel_closure1.call$1 (http://localhost:62880/dwds/src/injected/client.js:23874:60)
at _EventStreamSubscription_closure.call$1 (http://localhost:62880/dwds/src/injected/client.js:18042:26)
at StaticClosure._rootRunUnary (http://localhost:62880/dwds/src/injected/client.js:4829:16)
at _CustomZone.runUnary$2$2 (http://localhost:62880/dwds/src/injected/client.js:12879:39)
at _CustomZone.runUnaryGuarded$1$2 (http://localhost:62880/dwds/src/injected/client.js:12826:14)
at _CustomZone_bindUnaryCallbackGuarded_closure.call$1 (http://localhost:62880/dwds/src/injected/client.js:13016:25)
at invokeClosure (http://localhost:62880/dwds/src/injected/client.js:1524:26)
at WebSocket.<anonymous> (http://localhost:62880/dwds/src/injected/client.js:1543:18)
Expected behavior
No crash.
Sample project
firebase_messaging
Flutter doctor
Run flutter doctor and paste the output below:
Click To Expand
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.2.1 20D74 darwin-x64, locale en-EE)
• Flutter version 2.5.3 at /Users/silver/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (7 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/silver/Library/Android/sdk
• Platform android-31, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
[✓] VS Code (version 1.62.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.27.0
[✓] Connected device (3 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.55
Flutter dependencies
Run flutter pub deps -- --style=compact and paste the output below:
Click To Expand
% flutter pub deps -- --style=compact
Dart SDK 2.14.4
Flutter SDK 2.5.3
firebase_messaging_example 0.0.0
dependencies:
- firebase_core 1.10.1 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_messaging 11.2.0 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- flutter_local_notifications 8.2.0 [flutter flutter_local_notifications_platform_interface platform timezone]
- http 0.13.4 [async http_parser meta path]
dev dependencies:
- drive 1.0.0-1.0.nullsafety.1 [test_api flutter_test flutter_driver stack_trace flutter]
- flutter_driver 0.0.0 [file flutter flutter_test fuchsia_remote_debug_protocol path meta vm_service webdriver archive async boolean_selector characters charcode clock collection crypto matcher platform process source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api typed_data vector_math]
- test 1.17.10 [analyzer async boolean_selector collection coverage http_multi_server io js node_preamble package_config path pedantic pool shelf shelf_packages_handler shelf_static shelf_web_socket source_span stack_trace stream_channel typed_data web_socket_channel webkit_inspection_protocol yaml test_api test_core]
dependency overrides:
- firebase_core 1.10.1 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_core_platform_interface 4.2.0 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.3.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_messaging 11.2.0 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- firebase_messaging_platform_interface 3.1.0 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 2.2.0 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- plugin_platform_interface 2.0.2 [meta]
transitive dependencies:
- _fe_analyzer_shared 31.0.0 [meta]
- analyzer 2.8.0 [_fe_analyzer_shared cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
- archive 3.1.2 [crypto path]
- args 2.3.0
- async 2.8.1 [collection meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- characters 1.1.0
- charcode 1.3.1
- cli_util 0.3.5 [meta path]
- clock 1.1.0
- collection 1.15.0
- convert 3.0.1 [typed_data]
- coverage 1.0.3 [args logging package_config path source_maps stack_trace vm_service]
- crypto 3.0.1 [collection typed_data]
- fake_async 1.2.0 [clock collection]
- file 6.1.2 [meta path]
- flutter_local_notifications_platform_interface 4.0.1 [flutter plugin_platform_interface]
- 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]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- frontend_server_client 2.1.2 [async path]
- fuchsia_remote_debug_protocol 0.0.0 [process vm_service file meta path platform]
- glob 2.0.2 [async collection file path string_scanner]
- http_multi_server 3.0.1 [async]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- io 1.0.3 [meta path string_scanner]
- js 0.6.3
- logging 1.0.2
- matcher 0.12.10 [stack_trace]
- meta 1.7.0
- mime 1.0.1
- node_preamble 2.0.1
- package_config 2.0.2 [path]
- path 1.8.0
- pedantic 1.11.1
- platform 3.0.0
- pool 1.5.0 [async stack_trace]
- process 4.2.3 [file path platform]
- pub_semver 2.1.0 [collection meta]
- shelf 1.2.0 [async collection http_parser path stack_trace stream_channel]
- shelf_packages_handler 3.0.0 [path shelf shelf_static]
- shelf_static 1.1.0 [convert http_parser mime path shelf]
- shelf_web_socket 1.0.1 [shelf stream_channel web_socket_channel]
- sky_engine 0.0.99
- source_map_stack_trace 2.1.0 [path stack_trace source_maps]
- source_maps 0.10.10 [source_span]
- 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]
- sync_http 0.3.0
- term_glyph 1.2.0
- test_api 0.4.2 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- test_core 0.4.0 [analyzer async args boolean_selector collection coverage frontend_server_client glob io meta package_config path pedantic pool source_map_stack_trace source_maps source_span stack_trace stream_channel vm_service yaml matcher test_api]
- timezone 0.8.0 [path]
- typed_data 1.3.0 [collection]
- vector_math 2.1.0
- vm_service 7.1.1
- watcher 1.0.1 [async path]
- web_socket_channel 2.1.0 [async crypto stream_channel]
- webdriver 3.0.0 [archive matcher path stack_trace sync_http]
- webkit_inspection_protocol 1.0.0 [logging]
- yaml 3.1.0 [collection source_span string_scanner]
Bug report
firebase_messaging example application crashes when run in web.
Expected behavior
No crash.
Sample project
firebase_messaging
Flutter doctor
Run
flutter doctorand paste the output below:Click To Expand
Flutter dependencies
Run
flutter pub deps -- --style=compactand paste the output below:Click To Expand