Issue while having both FCM and APNS active
Hi all.
I'm facing a strange issue while having both FCM and APNS integrations set and active.
I'm setting the credentials for a subscriber with an APNS token like this:
So the subscriber has a token related to apns. But when I'm trying to send a push notification to that user using an existing template, I'm getting FCM related errors.
Do I miss a step of the process?
Thanks!
43 Replies
As you have both providers active,
Did you add fcm deviceToken also for this particular subscriber?
No, I only have apns token set.
I guess that's the reason of this. It requires valid FCM token as well if FCM is active
I don't think that it makes sense though. There are users that have android devices and others with ios devices and we need to send notifications to all of them. I guess that this is a pretty common case in general.
Ohh! I got your usecase.
So one solution I can think of is, there should be option to activate/deactivate any of provider dynamically during trigger
I can't see an option in trigger endpoint. I can see only an API to update an integration (i.e. set it on/off) but in any case this will be an overkill to do for every notification. In addition, I'm sure that it will create problems when many notifications will being sent in parallel.
I've tested it further and it seems that it tries to send notifications using every active integration, regardless of the subscriber's credentials. So, for example:
- FCM -> active
- APNS -> active
- Subscriber has only FCM token set in credentials.
- Send push notification
- 2 actions have been triggered:
- sent with FCM successfully
- failed to send with APNS (due to lack of token)
-- From my point of view, the expected scenario would be to send one notification using FCM since this is what the subscriber has credentials for.
Of course the above example is the same for the other way around (only apns token).
I believe that the provider should be used according to the subscriber's credentials so that the system can send notifications to users that have only android or ios devices without the need of constantly activating/deactivating the providers. I think it's the normal and most common case and not an exceptional scenario.
Good morning!
Another thing I noticed is the following:
- Activate FCM
- Activate APNS
- Create a subscriber with both FCM and APNS tokens
- When sending push notifications, Novu tries to send both notifications with FCM. So, for the second token it will get an error because it's not a valid FCM token but an APNS one. It looks like it gets the first active integration and use it for everything.
and both tokens are valid tokens
Yes, FCM valid token and APNS valid token
So, it seems that when I have 2 tokens set in the subscriber, Novu uses FCM for both, regardless of the APNS's provider state (active/inactive)
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It's not on GitHub
It is in triage in linear.
Any updates on this?
GitHub
🐛 Bug Report: Wrong provider is selected when sending a push notifi...
📜 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), w...
@frnandu
Currently, override is possible in sms and email providers only
We are working on addding this option for chat and push channel providers
Any idea on expected time?
Without this, I will be forced to make separate workflows for fcm/apns and handle that on backend, which is a pain...
@frnandu
I have shared this with team
I will revert back with possible ETA
Even with separate workflows, it is not possible to use fcm provider for one workflow and apns for another. This basically makes it impossible to use simultaneously PUSH for fcm and apns even if you'd filter on backend for different workflows depending on user having credentials (deviceTokens) for android or ios. Please make this a top priority on your team, otherwise Novu becomes unable of handling PUSH's for mixed users of android/ios.
This https://github.com/novuhq/novu/issues/3797 was marked as fixed/closed but I've just tested 0.20.0 docker images and the problem is still happening.
GitHub
[NV-2935] 🐛 Bug Report: Wrong provider is selected when sending a p...
📜 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), w...
@frnandu, you just advanced to level 2!
Can you try setting in the environment variables of the API, Worker and Web apps the following environment variable:
This will enable the multi provider feature that includes the fix of the bug you have noticed and the fix that has been applied in that PR.
Notice that this feature changes the behaviour for email and SMS providers allowing to have multiple active providers set. So try this in a DEV environment to see that it shows the fix but without affecting to your current flow, as a caution. measure.
Here you have a small reference regarding setting the feature flags in case you need it: https://docs.novu.co/community/run-in-local-machine#set-up-your-environment-variables
Novu
Run Novu in local machine - Novu
Prerequisites and steps to run Novu in local machine. Learn how to set up Novu on your local environment for testing and development.
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?
Yes, can you double check in your development environment that botch FCM and APNs providers are set as active both? We can just double check the behaviour in your DEV environment.
After that I would ask you to double check that you have set the device tokens appropriately for the subscribers, the ones meant to be notified through FCM in that integration and the ones meant to be notified through APNs in that other integration.
I already checked that few times. Both providers are active. And using REST API
curl 'http://api.novu.svc.kube.internal.filmweb.pl:3000/v1/subscribers/<subscriber-id>
I confirmed that each user to which is triggered the worflow, one has deviceTokens and providerId: "fcm" , and the second one has also deviceTokens and providerId: "apns"
I confirmed also that when I disabled one of the providers (FCM or APNS) and triggered only for the appropriate user, it sent successfully, so the deviceTokens are confirmed to be correct.
But on the workflow settings only APNS is visible as active on production.Even tough on you click Configure (or go to Integrations Store) both are active:
If I disable APNs, it shows this:
Even tough FCM is active on the Integrations Store screen
And the funny thing is, if you go on Development Tab (because all of this was on production), it shows FCM provider as active, and it just has the same problem but for the APNs...
Just last question before asking you to open an issue because indeed it looks we are into something. Confirm me that the menu entry Changes doesn't have any changes to promote from Dev to Production and we are dealing with the same configuration.
Anyway in the Development environment you should already be able to send notifications to both FCM and APNs when both are active.
In last screen you can see there are no Changes to promote (would show a red number next to it)
But even in the development (as you can see in last screen), it doesn't seem to have APNs active in the workflow...
That's true and that's why I asked about changes. It is weird. To just clarify, are you able to enable APNs in your Dev environment?
In integrations store screen both FCM and APNs providers are active in both Production and Development.
as you can see here
Please open a GitHub issue with all this information if you haven't done it yet so we can prioritise the investigation. Thank you very much for being patient and providing so much info. 🙏
But there is already an issue, it got closed but it is not fixed
GitHub
[NV-2935] 🐛 Bug Report: Wrong provider is selected when sending a p...
📜 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), w...
I suggest to re-open it
I was just doing that 😄
Sorry, I wasn't aware of that issue open.
Thank you
@frnandu, you just advanced to level 3!