firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

Bug Report : Registration failed - push service error

Open naveedahmed1 opened this issue 5 years ago • 17 comments

[REQUIRED] Describe your environment

  • Operating System version: Windows 10
  • Browser version: Chrome Version 83.0.4103.61 (Official Build) (64-bit)
  • Firebase SDK version: 7.15.0
  • Firebase Product: Firebase Messaging

[REQUIRED] Describe the problem

I'm using Angular Fire and when requesting token using below code it throws error

Code

this.messaging.requestToken
      .subscribe((token) => {
        this.sendTokenToServer(token);
      },
        (error) => {
          console.error(error);
          this._gs.hideOverlay();
        },
      );

Error Uncaught DOMException: Registration failed - push service error

This issue occurs randomly, I mean the same code which works perfectly suddenly breaks and start throwing this errror.

If I create a new profile on Chrome (i.e. a new user), the exact same code starts working on same machine.

I think its an old issue but has not be permanently fixed, and I believe this should be thoroughly investigated and fixed.

Below are the issues I found on Firebase and Angular Fire Repos,

https://github.com/firebase/firebase-js-sdk/issues/909

https://github.com/FirebaseExtended/polymerfire/issues/345

https://github.com/firebase/firebase-js-sdk/issues/771

https://github.com/firebase/firebase-js-sdk/issues/152

https://github.com/angular/angularfire/issues/2475

Steps to reproduce:

I have no idea whats actually causing the issue and issue occurs randomly, hence don't know how to reproduce the issue.

For https://www.mustakbil.com/ its working for some users and not for others. In my case its working fine on Android and broken on desktop, if I setup new profile it works jut fine.

The issue is, its broken even for some of the new and first time users of the website.

Relevant Code:

Angular Fire code.

this.messaging.requestToken
      .subscribe((token) => {
        this.sendTokenToServer(token);
      },
        (error) => {
          console.error(error);
          this._gs.hideOverlay();
        },
      );

I would have reported this issue on Angular Fire repo, but in my opinion the issue is related to Firebase library. Since I have seen posts complaining about same issue while using different frameworks.

Thank you or your attention to this issue.

naveedahmed1 avatar Jun 09 '20 09:06 naveedahmed1

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Jun 09 '20 09:06 google-oss-bot

Same issue yesterday on a stable PWA deployed many months ago. However it seems to be browser related. Clearing Service workers and storage in Chrome Dev Tools / Application have fixed the problem.

mmikrut avatar Jun 17 '20 22:06 mmikrut

Clearing Service workers and storage in Chrome Dev Tools / Application have fixed the problem.

In my case even this doesn't work unless I creat new user profile (reported by other users as well)

I also initially thought this that it must be related to the browser but then I came across the other demos of firebase push notifications, hosted on different domains and all of them had the same issue on the same chrome user profile. But when I tested it with other websites that were for example using other push notification service providers for example one signal it was working fine on same user profile of chrome.

naveedahmed1 avatar Jun 17 '20 22:06 naveedahmed1

I still think its browser related, as we just tested, same user on two PCs ( iMac & Linux), both running newest version of chrome. PWA works on iMac, chrome on linux displays push service error

mmikrut avatar Jun 20 '20 11:06 mmikrut

In my case it only happens with sites using firebase js sdk.

naveedahmed1 avatar Jun 21 '20 15:06 naveedahmed1

I left a comment on the other issue, but this is a super annoying issue so I'm going to link that comment here as well: https://github.com/angular/angularfire/issues/2475#issuecomment-711099922

shadow1349 avatar Oct 20 '20 00:10 shadow1349

I'm also facing this issue, but that happens only Brave (even when I deactivate the privacy shield); Edge, Firefox and Opera are working fine.

I'm using a npm version of firebase (7.23.0) inside of a React app that has another service worker running, if that helps contextualizing the problem :)

hdoro avatar Oct 20 '20 18:10 hdoro

Yeah all the other browsers were working ok for me, but Brave is my main browser

shadow1349 avatar Oct 20 '20 19:10 shadow1349

same error here!, also using brave in linux

eugenioclrc avatar Oct 28 '20 23:10 eugenioclrc

Any update on this?

I just checked chrome://gcm-internals/ and under Registration Log it shows TOO_MANY_REGISTRATIONS. Any idea what could have caused this? And how to fix this?

naveedahmed1 avatar Nov 25 '20 19:11 naveedahmed1

If I take a look at Registration Log it seems any call to messaging.getToken and messaging.requestToken methods tries to get registration token with a new random App Id. as a result we have too many registrations.

Example 'App Id's

wp:https://www.mustakbil.com/#BB0DB796-278C-474F-A734-32B35E3E2-V2
wp:https://www.mustakbil.com/#D00AD433-4922-4E22-846D-05DF35109-V2
wp:https://www.mustakbil.com/#D00AD183-4922-4E22-885D-05DF35109-V2
wp:https://www.mustakbil.com/#3FF9E22C-231B-4C61-9C1E-F38B31290-V2
wp:https://www.mustakbil.com/#D7158487-E513-4C08-A904-373567A69-V2

naveedahmed1 avatar Nov 25 '20 20:11 naveedahmed1

I have also opened a issue with Chrome team, https://bugs.chromium.org/p/chromium/issues/detail?id=1153182

naveedahmed1 avatar Nov 27 '20 16:11 naveedahmed1

Any updates on this? Still happens in Brave in Manjaro Linux

marcusmmmz avatar Apr 17 '21 14:04 marcusmmmz

I'm also experiencing same issue on Brave and Chrome. Same code which has been working for more than 6 months just started throwing that error this week

natemartins avatar Apr 21 '21 23:04 natemartins

any updates on this we are getting the same error intermittently

aalluri7 avatar May 05 '21 22:05 aalluri7

This is intentional behavior in Brave, they disable using Google's push service by default for privacy reasons. As far as I have seen, they do not have on their roadmap a replacement for it and will continue to leave it disabled by default. You can enable it by going to brave://settings/privacy and enabling "Use Google services for push messaging." Here are some related issues:

  1. https://github.com/brave/brave-browser/issues/15062
  2. https://github.com/brave/brave-browser/issues/2362

wbobeirne avatar May 25 '21 16:05 wbobeirne

@wbobeirne Thanks, it helps a lot.

atzzCokeK avatar Jul 11 '22 08:07 atzzCokeK

It's been a while. Checking in to see if this is a Brave configuration issue for folks that's helped by wboberine's post above. Thanks!

DellaBitta avatar Jun 07 '23 15:06 DellaBitta

I have the same issue on Android Chrome,Does anybody resolved?

soulcm avatar Jun 09 '23 05:06 soulcm

@soulcm, is your environment the same as the original ticket? If not, I'd ask you to create a new issue with details about the configuration you're using and the code that's failing. Thanks!

DellaBitta avatar Jun 15 '23 01:06 DellaBitta

In my experience the issue occurs on frequent calls to requestToken / deleteToken. In our case, we were calling requestToken on user login and deleteToken on user logout from our website, or when user clicks the toggle notifications button i.e. call requestToken when user clicks Enable Notifications button and call deleteToken when user click Disable Notifications button.

As a workaround, we now never call deleteToken, instead we track the unsubscription on our own server.

naveedahmed1 avatar Jun 17 '23 22:06 naveedahmed1

In my experience the issue occurs on frequent calls to requestToken / deleteToken. In our case, we were calling requestToken on user login and deleteToken on user logout from our website, or when user clicks the toggle notifications button i.e. call requestToken when user clicks Enable Notifications button and call deleteToken when user click Disable Notifications button.

As a workaround, we now never call deleteToken, instead we track the unsubscription on our own server.

following up on this thread, couple qs:

  • @naveedahmed1 know this is an old thread, but what SDK versions are you on? are you still seeing this error?
  • out of curiosity: we track the unsubscription on our own server how is this flow currently implemented in breid

zwu52 avatar Jun 27 '23 17:06 zwu52

Hey @naveedahmed1. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 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 avatar Sep 12 '23 01:09 google-oss-bot

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

@naveedahmed1 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.

google-oss-bot avatar Sep 18 '23 01:09 google-oss-bot