novuhq / novu

Open-Source Notification Platform. Embeddable Notification Center, E-mail, Push and Slack Integrations.
https://novu.co
Other
34.46k stars 3.51k forks source link

[NV-2935] 🐛 Bug Report: Wrong provider is selected when sending a push notification (if we have 2 active providers of same type) #3797

Open christos-deretzis opened 1 year ago

christos-deretzis commented 1 year ago

📜 Description

In the case of the push notifications, given that we have 2 active providers in the same organization: fcm (for android and web push notifications) and apns (for ios notifications), when we have a subscriber that has setup only a device token for ios and we want to trigger a push notification for the specific subscriber, when it goes to select the appropriate provider to send the push notification, instead of choosing the apns, fcm is chosen. This bug is shown in version 0.16.3 .

👟 Reproduction steps

  1. Setup fcm and apns providers
  2. Create a subscriber that has both an fcm and an apns token
  3. Trigger a push notification for this specific subscriber
  4. The first notification (apns for ios) is sent successfully but the second one (android) is not sent successfully since it uses apns instead of fcm (I believe the issue is in selecting the wrong provider when the specific channel has more than one active providers)

👍 Expected behavior

It should use the fcm provider

👎 Actual Behavior with Screenshots

Screenshot 2023-07-14 at 1 46 40 PM

📃 Provide any additional context for the Bug.

No response

👀 Have you spent some time to check if this bug has been raised before?

🏢 Have you read the Contributing Guidelines?

Are you willing to submit PR?

None

NV-2935

jainpawan21 commented 1 year ago

@ainouzgali Is there any way we can choose a provider using overrides?

DiSonDS commented 11 months ago

Any updates? This bug is actual in v0.19.0

frnandu commented 11 months ago

Needing this to be fixed very critically, any plans when to address this?

scopsy commented 11 months ago

Hi @frnandu this should be available as a fix on our latest v0.20.0 release docker images are already available and will be released during this week.

frnandu commented 10 months ago

I've just tried v0.20.0 docker images and the problem still manifests. I have 2 providers active (FCM & APNs), different users have deviceTokens on the correspondent provider (checked with API rest), and when triggering, the subscriber with "providerId": "apns" still gets error: "Sending message failed due to \"The registration token is not a valid FCM registration token\""

frnandu commented 10 months ago

Ok, I just tested with IS_MULTI_PROVIDER_CONFIGURATION_ENABLED='true' and the behaviour now is shows FCM as the provider on development (only), and APNs on production (only). And when triggering on production for mixed users, it tries to send for both users using APNs and it fails on the user that has fcm tokens and "providerId": "fcm" Do you need more information to help diagnose the problem?

p-fernandez commented 10 months ago

@frnandu after our chat I am reopening this in order for us to investigate. Thank you for the information.