Duplicate FCM web push notifications
FCM web push notifications are being received twice in a single trigger everytime.
7 Replies
Hi @phineasondrugs, I'm an AI assistant for Novu. While a team member reviews this question, I'll see if I can find relevant sources for your question.
-----------------------------
While I generate an answer, here are some sources that might be helpful:
* How to send web push notifications with FCM and Novu
* Firebase Cloud Messaging (FCM)
* How to send push notifications to Flutter apps (Android & iOS) with FCM using Novu
* Push
-----------------------------
Answer
I understand you're experiencing an issue with duplicate FCM web push notifications being received twice for a single trigger. Let me provide some information based on the available sources that might help address this problem.
The issue of duplicate FCM web push notifications has been reported by other users as well (1) . It appears that this problem can occur when using the method described in the Novu documentation for sending web push notifications with FCM (2) .
The cause of this issue seems to be related to how the
onBackgroundMessage
handler works with FCM. When the payload contains a notification
object, FCM's messaging service automatically displays a push notification on its own, in addition to the one being handled by your custom code (1) .
To prevent these duplicate notifications, you might need to modify how you handle background messages. However, it's important to note that simply changing the onBackgroundMessage
handler may not fully resolve the issue, as the duplicate notification appears to be coming from FCM itself .
Unfortunately, the current documentation doesn't provide a direct solution to this specific problem (2) (3) . Given the complexity of this issue and the lack of a clear solution in the official documentation, it might be beneficial to explore this further with the Novu community or development team.
Since I couldn't find a definitive solution in the provided information sources, I suggest you click on the "Ask for help" button to tag a team member to review your question. They may have more up-to-date information or specific solutions for handling this duplicate notification issue with FCM web push notifications.
Feel free to tag @Ask Inkeep with additional questions.
Got it. Tagging @Support for additional help.
Glad I could be helpful. Feel free to create a new thread with any new questions you may have.
@phineasondrugs
Do you have two same deviceTokens set for this subscriber?
Nope, the tokens were unique. However, this issue has already been solved.
Would you like to share what was the root cause?
It turns out that I was using the onBackgroundMessage function which I did not have to.