APNS error while sending notification (v 0.12.0)
Hi all!
I'm trying to send push notification using APNS (since the topicID issue has been fixed in 0.12.0 - thanks for that! ).
I have configured and activated the provider but when I trigger the notification I get an error without any helpful message:
{
"stack": "Error: \n at APNSPushProvider.<anonymous> (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:84:35)\n at step (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:44:23)\n at Object.next (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:25:53)\n at fulfilled (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:16:58)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)",
"message": ""
}
The request I use is the following:
{
"name": "ios-test",
"to": {
"subscriberId": "sera-12345"
},
"payload": {
},
"overrides": {
}
}
I'd appreciate any thoughts on this.17 Replies
Did you duble check your APNS creds?
I'm trying to turn production on (in APNS provider's config) to check if there is an issue in sandbox but the toggle button doesn't seem to work..
I tried from both development and production environments.
I'm using a valid token and I managed to send a notification from "Swifty Pusher" (test notification app). However, I noticed that I can only send it successfully using prod. In sandbox I'm getting a bad token error. So, I think that it might work if I could turn APNS provider to production..
To help you more, when I turn Novu environment to production I get the same error but with a message this time which is also weird š
Error from development:
{
"stack": "Error: \n at APNSPushProvider.<anonymous> (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:84:35)\n at step (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:44:23)\n at Object.next (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:25:53)\n at fulfilled (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:16:58)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)",
"message": ""
}
Error from production:
{
"stack": "Error: 85a57fd53908d108da4c3fe1da073677c418e3bb7674f96e2cb46bcc69eb8a3c failed for reason: BadDeviceToken\n at APNSPushProvider.<anonymous> (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:84:35)\n at step (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:44:23)\n at Object.next (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:25:53)\n at fulfilled (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:16:58)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)",
"message": "85a57fd53908d108da4c3fe1da073677c418e3bb7674f96e2cb46bcc69eb8a3c failed for reason: BadDeviceToken"
}
Do you know if the "Production" toggle button is supposed to work or if there is another way to set it to true (maybe with an API call to update the integration?)
I managed to set production to ON by creating the APNS integration with an API call:
{
"providerId": "apns",
"channel": "push",
"credentials": {
"secretKey": "-----BEGIN PRIVATE KEY-----scscds-----END PRIVATE KEY-----",
"apiKey": "asdasdasdsa",
"projectName": "adadsadsa",
"applicationId": "com.aryansbtloe.apns-tester.sample.ios",
"secure": true
},
"active": true,
"check": true
}
The field secure
is the one that maps to production toggle.
However, I'm still getting the same error for a valid token which is reachable from other testing apps..Now it is working for you?
Ohh!
Has anyone managed to send an ios push notification?
Need to check it thoroughly!
I have limited knowledge of APNS
I'm attaching the last error from Novu's production environment when trying with a valid token:
{
"stack": "Error: \n at APNSPushProvider.<anonymous> (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:84:35)\n at step (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:44:23)\n at Object.next (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:25:53)\n at fulfilled (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:16:58)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)",
"message": ""
}
UPDATE:
We discovered something interesting today.
When we use a valid token, the notification is being received BUT we get an error (with an empty message) and the transaction is marked as failed.
{
āstackā: āError: \n at APNSPushProvider.<anonymous> (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:84:35)\n at step (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:44:23)\n at Object.next (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:25:53)\n at fulfilled (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:16:58)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)ā,
āmessageā: āā
}
When we use a wrong token then we get an error with the correct message and the transaction is also being marked as failed.
{
āstackā: āError: 85a57fd53908d108da4c3fe1da073677c418e3bb7674f96e2cb46bcc69eb8a3 failed for reason: BadDeviceToken\n at APNSPushProvider.<anonymous> (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:84:35)\n at step (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:44:23)\n at Object.next (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:25:53)\n at fulfilled (/usr/src/app/providers/apns/build/main/lib/apns.provider.js:16:58)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)ā,
āmessageā: ā85a57fd53908d108da4c3fe1da073677c418e3bb7674f96e2cb46bcc69eb8a3 failed for reason: BadDeviceTokenā
}
So, in both cases the transaction is marked as failed but in the first case we actually saw it coming in.@Pawan Jain I created 2 bugs for the above issues:
https://github.com/novuhq/novu/issues/2966
https://github.com/novuhq/novu/issues/2967
GitHub
[NV-1817] š Bug Report: APNS delivered notifications marked as fail...
š Description We discovered something interesting while testing APNS integration for sending ios push notifications. When we use a valid token, the notification is being received BUT we get an erro...
GitHub
[NV-1818] š Bug Report: APNS production toggle can't be turned on (...
š Description In APNS provider there is a Production toggle that, as far as I can tell, defines if the notification will be sent to sandbox or production. This toggle cannot be turned on using the ...
Thanks @serafeimo
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
Hello @serafeimo, @omerbenami
Both of these issues have been fixed and merged to the next branch,
We will release a patch version soon.
That's great news. Thanks @biswaviraj !
Is there an expected date for this patch?
Hi all! Is there any update on the release date? Thanks!
@serafeimo 0.13.0 is coming out this week
@serafeimo We have released 0.13.0, let us know if you are still facing this issue