JavaScript Firebase Cloud Messaging delivering duplicate push notifications

1,010 views
Skip to first unread message

César de Tassis Filho

unread,
Feb 18, 2018, 7:49:00 PM2/18/18
to Firebase Google Group
I have a website and I use Firebase to deliver push notifications to my visitors' browsers.

After upgrading from Firebase 4.9.1 to 4.10.0 I noticed that my own browsers were receiving the same push notifications twice. I also noticed lots of new token registrations on my backend database and these new tokens came from browsers that were already registered before.

After a little bit of research here's what I've found out:

It seems that Firebase versions < 4.10.0 were storing FCM token data on an indexedDB named "undefined". After upgrading to 4.10.0 Firebase started saving FCM token data on an indexedDB named "fcm_token_details_db". That resulted in two valid tokens registered in two different indexedDBs. Both tokens seemed to work fine when notifications were sent to them, none of them returned NotRegistered.

I'm not sure that indexedDB named "undefined" is a result of my (probably bad) coding, but I guess it is an issue with old Firebase versions. It was working fine before, but now that the name of the indexedDB changed I think it will result in duplicate notifications for every site that upgrades from versions < 4.10.0 to version 4.10.0.

I'm also not sure if it is the best solution here, but deleting that "undefined" indexedDB seems to fix the issue:

indexedDB.deleteDatabase("undefined");

Do you guys think it is worth a GitHub issue? I can provide more information about my code and my site's setup if more troubleshooting is needed.

Thanks in advance,
César

Matt Gaunt

unread,
Feb 20, 2018, 6:59:03 PM2/20/18
to Firebase Google Group
Hello,

Thanks for pointing this out and it's definitely a bug, sorry it wasn't caught during QA (and it looks like a long standing bug has existed in the SDK to be using the database name "undefined").

I've opened up a PR that should perform the clean up of this issue here: https://github.com/firebase/firebase-js-sdk/pull/523

I'll update with more details as things progress.

Matt

Matt Gaunt

unread,
Feb 26, 2018, 2:56:35 PM2/26/18
to Firebase Google Group
This should be fixed in 4.10.1. Sorry for the problem in 4.10.0
Reply all
Reply to author
Forward
0 new messages