Meteor-Community-Packages / Meteor-Community-Packages/raix-push
APN Feedback Service not working
- Dominant language
- JavaScript
- Stars
- 505
- Forks
- 191
- PR merge metrics
- No merged PRs in 30d
Description
Affected Version: 3.3.0
The configuration of the Feedback Service does not work with documented raix config.
certData and keyData are nested under options.apn.certData and options.apn.keyData.
_https://github.com/raix/push/blob/v3.3.0/lib/server/push.api.js#L242_
```
var feedbackOptions = {
'batchFeedback': true,
// Time in SECONDS
'interval': 5,
production: !options.apn.development,
cert: options.certData,
key: options.keyData,
passphrase: options.passphrase
};
var feedback = new apn.Feedback(feedbackOptions);
```
So it should be:
```
var feedbackOptions = {
'batchFeedback': true,
// Time in SECONDS
'interval': 5,
production: !options.apn.development,
cert: options.apn.certData,
key: options.apn.keyData,
passphrase: options.passphrase
};
var feedback = new apn.Feedback(feedbackOptions);
```
Making this change fixes the configuration. However, once configured properly an additional downstream error is thrown. The on 'feedback' callback function is not bound to the meteor environment.
> Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
_https://github.com/raix/push/blob/v3.3.0/lib/server/push.api.js#L254_
```
feedback.on('feedback', function (devices) {
devices.forEach(function (item) {
// Do something with item.device and item.time;
// console.log('A:PUSH FEEDBACK ' + item.device + ' - ' + item.time);
// The app is most likely removed from the device, we should
// remove the token
_removeToken({
apn: item.device
});
});
});
```
Contributor guide
Research direction
Start by reading lib/server/push.api.js around lines 242 and 254, then trace how the APN feedback options and callback are initialized. Confirm the documented nested configuration is honored and that feedback processing completes without a Meteor Fiber error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100