You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
not receiving notification and give error code 422 #289
event_log_61fba775059aea0011c02462.json.zip
I am able to create session sucessfully , chatting is also working fine , i can also see the push notification token in our admin panel but for some reason i am getting 401 in push notification JSON
this issue is only facing in IOS side !
@arnofo No brother , i am not able to send and receive push notification with connectycube :( , so i had implement push notification by REST API . Thank You
@arnofo according to backend log, the notification is failed to delivery with error status code 401, so the APNS server failed to accept the push request by some reason.
401 generally means Unauthorised. There could be one main reason:
could you check/show us your certificate/token settings at Admin panel. It could that the data you set is wrong , which I think should be a case here
@arnofo one more question
when you subscribe to pushes via 'create subscription' API, do you pass bundle_id or not?
If yes, is it equal to bundle_id of you APNS certificate?
@arnofo another idea is that you use wrong device token when subscribe to push notifications. It should be around 64 chars.
Could you show an example of your device token so we can compare?
Also, please provide a code snippet how you obtain device token via notifee lib. It might be you are using wrong method. Let's check together
You were right i was not getting the proper token for IOS. I misunderstood the full scope of how the push notifications worked with ConnectyCube. (i did not do the initial setup on the project i am working on)
Connectycube uses firebase to send Android push notifications and APNs directly for IOS push notifications.
In my code, i was getting a token from Firebase for both platform :
// Get the token from FCMconsttoken=awaitmessaging().getToken();
// Request permissions (required for iOS)// requestPermissions will trigger registerForRemoteNotifications implicitly.// register listener will get device token.PushNotificationIOS.requestPermissions({alert: true,badge: true,sound: true,});PushNotificationIOS.addEventListener('register',(token)=>{consttoken=token;});
Then you use the token to create the subscription on Connectycube.
Few other clues that might help people that wanted to use notifee:
I used messaging().onMessage and messaging().setBackgroundMessageHandler to listen for firebase push notification
I used PushNotificationIOS.addEventListener('notification', ... ) to listen for APNs push notification
For both Firebase and APNs listeners, i call a function that displays the notification with notifee : notifee.displayNotification
I handle press actions and openings with notifee.onForegroundEvent and for completeness i also use notifee notifee.getInitialNotification when the app is opening from quit state.
(I still have a few edge cases to handle but most of the solution is working now)
Activity
ccvlad commentedon Jan 25, 2022
https://developers.connectycube.com/reactnative/push-notifications?id=subscribe-to-push-notifications
ParmarJigarr commentedon Jan 25, 2022
Yes , i have already performed this steps still getting this error in catch block
ccvlad commentedon Jan 25, 2022
Attach logs were you do request and get response on subscription. And logs with the error 422
ParmarJigarr commentedon Feb 3, 2022
event_log_61fba775059aea0011c02462.json.zip
I am able to create session sucessfully , chatting is also working fine , i can also see the push notification token in our admin panel but for some reason i am getting 401 in push notification JSON
this issue is only facing in IOS side !
ParmarJigarr commentedon Feb 7, 2022
This is event log of successfully send message
event_log_6200adb8ebf9ca00184a7013.json.zip
ParmarJigarr commentedon Feb 22, 2022
Any update ?
DaveLomber commentedon May 3, 2022
@ParmarJigarr we brought a new push notifications library which addressed some issues #296
Please read the details and provide a feedback/comments if any
arnofo commentedon Jan 27, 2023
Hello @ParmarJigarr, did you ever fix this issue ?
I'm seeing the exact same error message in the
event_log_xxx.jsonas you did. Thx.ParmarJigarr commentedon Jan 27, 2023
@arnofo No brother , i am not able to send and receive push notification with connectycube :( , so i had implement push notification by REST API . Thank You
DaveLomber commentedon Jan 27, 2023
@arnofo could you let me know which issue you are having now
arnofo commentedon Jan 27, 2023
Here is the log from your backend :
event_log_63d2baf5669b24002fd6130a.zip
This issue i am seeing is only on IOS.
I am using notifee with remote notification support as the library for receiving notifications :
https://notifee.app/react-native/docs/ios/remote-notification-support
I was having issues with your library when opening (press action) notifications (especially when the app was in the background).
Everything works fine on Android.
I am now trying to test it on IOS but the notification never seems to be pushed to phone.
I believe it is not sent by APNs to the phone. Probably because of the 401 seen in the
event_log_xxx.json.DaveLomber commentedon Jan 29, 2023
@arnofo according to backend log, the notification is failed to delivery with error status code 401, so the APNS server failed to accept the push request by some reason.
401 generally means Unauthorised. There could be one main reason:
arnofo commentedon Jan 30, 2023
Here it is :
Yes that was my understanding of the 401 as well but without a more precise error message, i am having a hard time finding what exactly goes wrong.
These kind of 401 mean that we cannot push to the APNs server or that the push message is rejected by the specific device targeted ?
DaveLomber commentedon Jan 30, 2023
@arnofo one more question
when you subscribe to pushes via 'create subscription' API, do you pass
bundle_idor not?If yes, is it equal to bundle_id of you APNS certificate?
arnofo commentedon Jan 30, 2023
No i do not pass
bundle_id. I am going to try to debug again tomorrow, i will let you know if i find anything else.DaveLomber commentedon Jan 30, 2023
@arnofo another idea is that you use wrong device token when subscribe to push notifications. It should be around 64 chars.
Could you show an example of your device token so we can compare?
Also, please provide a code snippet how you obtain device token via
notifeelib. It might be you are using wrong method. Let's check togetherarnofo commentedon Feb 1, 2023
Hello @DaveLomber
You were right i was not getting the proper token for IOS. I misunderstood the full scope of how the push notifications worked with ConnectyCube. (i did not do the initial setup on the project i am working on)
Connectycube uses firebase to send Android push notifications and APNs directly for IOS push notifications.
In my code, i was getting a token from Firebase for both platform :
I should have been using the package @react-native-community/push-notification-ios :
Then you use the token to create the subscription on Connectycube.
Few other clues that might help people that wanted to use
notifee:messaging().onMessageandmessaging().setBackgroundMessageHandlerto listen for firebase push notificationPushNotificationIOS.addEventListener('notification', ... )to listen for APNs push notificationnotifee:notifee.displayNotificationpressactions and openings withnotifee.onForegroundEventand for completeness i also use notifeenotifee.getInitialNotificationwhen the app is opening fromquitstate.(I still have a few edge cases to handle but most of the solution is working now)
Thanks for the help @DaveLomber.
DaveLomber commentedon Feb 1, 2023
@arnofo thanks for confirming it!
For someone who might use the
notifeelib as well - we added a ref to this GitHub issue from documentation https://developers.connectycube.com/reactnative/push-notifications?id=notifee-libI will close the issue for now then, feel free to open another one for any other issues/questions