N
Novu8mo ago
dave93

FCM Push Notifications

I am testing FCM push notifications, but when the workflow is executed I get this error message for the step in question: "Unexpected token } in JSON at position 2354"
18 Replies
dave93
dave938mo ago
Any news ?
Pawan Jain
Pawan Jain8mo ago
Hi @dave93 Above error means your service account json is not in correct format https://docs.novu.co/channels-and-providers/push/fcm#generating-a-service-account-key-json Could you please check?
dave93
dave938mo ago
Yes, now the error is : "Sending message failed due to "Requested entity was not found.""
Pawan Jain
Pawan Jain8mo ago
could you please share the error screenshot?
dave93
dave938mo ago
No description
dave93
dave938mo ago
This is the workflow
No description
dave93
dave938mo ago
Any news ?
Pawan Jain
Pawan Jain8mo ago
Hi @dave93. Are you self hosing Novu? If you are using novu cloud Could you please share the transactionId so we can debug
dave93
dave938mo ago
I use the self hosting Novu
Pawan Jain
Pawan Jain8mo ago
@dave93. Few possible reasons:- 1. service account credentials and credentials you used to generate device token is not matching 2. Your token is invalid 3. service account json is not valid https://stackoverflow.com/questions/56216887/requested-entity-was-not-found-when-trying-to-send-a-push-notification-using-fir#:~:text=So%20apparently%2C%20this%20error%20happens,and%20be%20done%20with%20it.
dave93
dave938mo ago
Thanks I solved it
Pawan Jain
Pawan Jain8mo ago
@dave93 Would you mind sharing what was the reason in your case?
dave93
dave938mo ago
The token was no longer valid, deleting it and generating a new one worked.I had opened another post for @novu/node that does not allow me to set up webPush, android, apns as you can see from the image. I use version 0.21.0
No description
Mauve
Mauve7mo ago
Hello everyone I have a question: does Novu use the firebase FCM best practice https://firebase.google.com/docs/cloud-messaging/manage-tokens Does Novu remove the old tokens automatically?
Pawan Jain
Pawan Jain7mo ago
@Mauve Currently Novu does not remove stale tokens automatically. User have to do it on their own We have an internal ticket for this. Hopefully we will support this in future
Mauve
Mauve7mo ago
is there anything else I need to be aware of when using novu with Firebase FCM? should I send the token on each app start? is there any recommendations about that?
Pawan Jain
Pawan Jain7mo ago
Checkout our FCM docs https://docs.novu.co/channels-and-providers/push/fcm In my knowledge, on each app start, a new token is not generated We have unique check in deviceTokens array so duplicate tokens will be discarded