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
topic
property is now REQUIRED sincenode-apn
changed the way to connect to APNs (thanks for the semver breaking BTW…) -
To find the previous issue, I had to dig in the
node-apn
code to reveal the error, asnode-pushnotifications
did 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-apn
may 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
topic
parameter 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-apn
the error is directly streamed to theresumed.messages
. If there is nofailure.error
info then a new error is generated with thefailure.response
info (comming from Apple).I can’t find where the
MissingTopic
error is raised. Could you point me to the line innode-apn
where 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
failure
object (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-pushnotifications
is not able to catch it and so it cannot be emmited…