node-pushnotifications: APN errors not retrieved properly + doc update?
I had a hard time understanding why my iOS push notifications suddenly did not work, and went through multiple issues:
-
The
topicproperty is now REQUIRED sincenode-apnchanged the way to connect to APNs (thanks for the semver breaking BTW…) -
To find the previous issue, I had to dig in the
node-apncode to reveal the error, asnode-pushnotificationsdid not show the error and only shows a successful promise with a failure count and no error message, even though the error message is return fromnode-apn. It seems thatnode-apnmay have changed the way it returns errors, and the result is that we cannot see the underlying error when a notification sending fails.
It would be nice to fix the doc regarding the topic property and to investigate why error messages are not reported correctly.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 18 (2 by maintainers)
I also just lost quiet some time due to this issue - i temporarily added a console log in the apn module so i could debug better.
Hello @sinedied, @appfeel, @miqmago regarding the
topicparameter I created a PR for the README update (https://github.com/appfeel/node-pushnotifications/pull/68) as a follow-up to https://github.com/appfeel/node-pushnotifications/issues/67Hmm… that’s a little bit messing. Regarding to documentate it in readme.md it’s easy.
Regarding to catch the error, the main purpose of the library was to standarize the response:
So when there is an error in
node-apnthe error is directly streamed to theresumed.messages. If there is nofailure.errorinfo then a new error is generated with thefailure.responseinfo (comming from Apple).I can’t find where the
MissingTopicerror is raised. Could you point me to the line innode-apnwhere this error is generated? Maybe in this way I could try to figure out how to stream the error…Also would be nice to have the
failureobject (if you could place a console.log of it) when this error is produced, in order to understand what is comming fromnode-apn. If the error is not comming,node-pushnotificationsis not able to catch it and so it cannot be emmited…