firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.8k stars 884 forks source link

firebase_messaging: abortError: Registration failed push service error on chrome mobile #7748

Open thunderbug1 opened 9 months ago

thunderbug1 commented 9 months ago

Operating System

Android 14; Pixel 6 Build/UP1A.231005.007; 34; REL

Browser Version

Google Chrome 118.0.5993.111 (Official Build) (64-bit)

Firebase SDK Version

firebase_messaging 14.7.3

Firebase SDK Product:

Messaging

Describe your project's tooling

Flutter with firebase_messaging. All the details are in this flutterfire issue: https://github.com/firebase/flutterfire/issues/11818

Additional context

Output of chrome version on the phone:

Click To Expand ``` Google Chrome | 118.0.5993.111 (Official Build) (64-bit) -- | -- Revision | 47c097e133ae535cd69c530a3c9a48e8fff3c825-refs/branch-heads/5993@{#1392} OS | Android 14; Pixel 6 Build/UP1A.231005.007; 34; REL APK versionCode | 599311133 APK targetSdkVersion | 34 isAtLeastU/targetsAtLeastU | true/true Google Play services | SDK=233700000; Installed=234212044; Access=1p JavaScript | V8 11.8.172.16 User Agent | Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Mobile Safari/537.36 ```

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` [✓] Flutter (Channel stable, 3.13.9, on Ubuntu 22.04.3 LTS 5.15.90.1-microsoft-standard-WSL2, locale en_US.UTF-8) • Flutter version 3.13.9 on channel stable at /home/developer/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision d211f42860 (8 days ago), 2023-10-25 13:42:25 -0700 • Engine revision 0545f8705d • Dart version 3.1.5 • DevTools version 2.25.0 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /home/developer/android-sdk-linux • Platform android-33, build-tools 33.0.0 • ANDROID_HOME = /home/developer/android-sdk-linux • ANDROID_SDK_ROOT = /home/developer/android-sdk-linux • Java binary at: /usr/bin/java • Java version OpenJDK Runtime Environment (build 17.0.8.1+1-Ubuntu-0ubuntu122.04) • All Android licenses accepted. [✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [✓] Linux toolchain - develop for Linux desktop • Ubuntu clang version 14.0.0-1ubuntu1.1 • cmake version 3.22.1 • ninja version 1.10.1 • pkg-config version 0.29.2 [!] Android Studio (not installed) • Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions). [✓] Connected device (1 available) • Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.3 LTS 5.15.90.1-microsoft-standard-WSL2 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 2 categories. ```

Flutter dependencies

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

Click To Expand ``` Dart SDK 3.1.5 Flutter SDK 3.13.9 fcm_test 1.0.0+1 dependencies: - cupertino_icons 1.0.6 - firebase_core 2.21.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_messaging 14.7.3 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math web sky_engine] - flutter_riverpod 2.4.5 [collection flutter meta riverpod state_notifier] dev dependencies: - flutter_lints 2.0.3 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math async boolean_selector characters collection material_color_utilities meta source_span stream_channel string_scanner term_glyph web] transitive dependencies: - _flutterfire_internals 1.3.11 [collection firebase_core firebase_core_platform_interface flutter meta] - async 2.11.0 [collection meta] - boolean_selector 2.1.1 [source_span string_scanner] - characters 1.3.0 - clock 1.1.1 - collection 1.17.2 - fake_async 1.3.1 [clock collection] - firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.8.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_messaging_platform_interface 4.5.12 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 3.5.12 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math web] - js 0.6.7 [meta] - lints 2.1.1 - matcher 0.12.16 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.5.0 [collection] - meta 1.9.1 - path 1.8.3 - plugin_platform_interface 2.1.6 [meta] - riverpod 2.4.5 [meta stack_trace state_notifier] - sky_engine 0.0.99 - source_span 1.10.0 [collection path term_glyph] - stack_trace 1.11.0 [path] - state_notifier 1.0.0 [meta] - stream_channel 2.1.1 [async] - string_scanner 1.2.0 [source_span] - term_glyph 1.2.1 - test_api 0.6.0 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - vector_math 2.1.4 - web 0.1.4-beta ```

Describe the problem

getToken() throws error [abortError: Registration failed push service error] when run as a web app on a mobile browser.

It works on Chrome desktop: image

But on the phone I get: Screenshot_20231102-095307

Steps and code to reproduce issue

Steps to reproduce the behavior:

Open the example deploment on a mobile browser and click the button, the result will be shown below the button.

example project source

deployment of example project

thunderbug1 commented 9 months ago

source issue: https://github.com/firebase/flutterfire/issues/11818

possibly related as well: https://github.com/gauntface/simple-push-demo/issues/377

DellaBitta commented 9 months ago

Can you confirm if you have Push Notifications enabled or disabled in your mobile Chrome browser? Thanks!

thunderbug1 commented 9 months ago

Can you confirm if you have Push Notifications enabled or disabled in your mobile Chrome browser? Thanks!

yes I can confirm that, under settings/notifications "All Chrome notifications" is "on" as well as "All General notifications" and the checkbox for the site in particular. I don't think that there is another checkbox that I would need to enable, or is there?

thunderbug1 commented 9 months ago

I used this phone a lot during development and so the getToken() Function was called a lot. Is it possible that I have an issue like this? https://github.com/firebase/firebase-js-sdk/issues/3195#issuecomment-733903830

when I open chrome://gcm-internals I do not see any logs.

zwu52 commented 9 months ago

The inconsistency is wired. Looking at your sw code https://github.com/thunderbug1/fcm_test/blob/main/web/firebase-messaging-sw.js have you tried to initialize similar to https://github.com/firebase/quickstart-js/blob/master/messaging/firebase-messaging-sw.js

nandinicbit1981 commented 9 months ago

I am noticing the same issue with our react native web app. This issue randomly occurs for some users only. Is there a workaround / fix for this issue?

i have tried logging out, clearing cache and reinstalling and nothing really works.

RoySchiffmannGrip commented 4 months ago

I get the same error when I'm using firebase node-module for my chrome extension, is this error getting attention?

Migushthe2nd commented 1 month ago

Same issue here. Also used this Pixel 6 for development, and I'm now unable to register with GCM in production nor development. Has been like this for almost a year now :(. Push Notifications are enabled in chrome. Also no logs under chrome://gcm-internals and it appears quite empty and broken: image

Clearing and/or reinstalling chrome/msedge does not fix the issue

I see a suggestion to clear the GCM store, but how would I do this on an Android device?

allentcm commented 1 week ago

I have the same issue. It is happening for random users only. I cannot replicate it locally but I can see a lot of errors in the Sentry logs.