Closed funkenstrahlen closed 6 years ago
parse server push adapter should throw an error that osx is unsupported push type as this is only supported with release 1.3.0.
Yeah not really, that would imply releasing a 1.2.1 with that ;)
if (this.validPushTypes.indexOf(pushType) < 0) {
throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED,
'Push to ' + pushType + ' is not supported');
}
This is already present in 1.2.0
.
Shouldn't the push config be:
push: {
ios:[{
pfx: __dirname + '/certs/' + process.env.APNS_IOS_CERTIFICATE, // The filename of private key and certificate in PFX or PKCS12 format from disk
bundleId: process.env.BUNDLE_ID_IOS, // The bundle identifier associate with your app
production: is_production // Specifies which environment to connect to: Production (if true) or Sandbox
}],
osx: [{
pfx: __dirname + '/certs/' + process.env.APNS_OSX_CERTIFICATE, // The filename of private key and certificate in PFX or PKCS12 format from disk
bundleId: process.env.BUNDLE_ID_OSX, // The bundle identifier associate with your app
production: is_production // Specifies which environment to connect to: Production (if true) or Sandbox
}]
},
It does support array or no array:
let apnsArgsList = [];
if (Array.isArray(args)) {
apnsArgsList = apnsArgsList.concat(args);
} else if (typeof args === 'object') {
apnsArgsList.push(args);
} else {
throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED,
'APNS Configuration is invalid');
}
So leaving the array away as I only have one certificate per deviceType is valid. It makes no difference to the error message if I add the arrays to the push config (just tried that).
uhh that's odd...
I think _iteratorError
is created by this code:
try {
for (var _iterator = pushTypes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var pushType = _step.value;
if (this.validPushTypes.indexOf(pushType) < 0) {
throw new _parse2.default.Error(_parse2.default.Error.PUSH_MISCONFIGURED, 'Push to ' + pushTypes + ' is not supported');
}
switch (pushType) {
case 'ios':
case 'tvos':
case 'osx':
this.senderMap[pushType] = new _APNS2.default(pushConfig[pushType]);
break;
case 'android':
case 'fcm':
this.senderMap[pushType] = new _GCM2.default(pushConfig[pushType]);
break;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
This is in lib/ParsePushAdapter.js
.
I know there will be no problem with osx
after 1.3.0
release. However this is an issue affecting all misconfigured push configurations.
I am facing the same problem with ios push notification,
push: {
ios:
[{
pfx: __dirname + process.env.CERT_PATH, // Dev PFX or P12
bundleId: process.env.BUNDLE_ID,
passphrase: process.env.CERT_PASSPHRASE,
production: true
}]
}
Here's the error
parse-server-push-adapter/lib/ParsePushAdapter.js:81
throw _iteratorError;
^
[object Object]
Seems to be a problem with the babel bump
If I remove the osx
push configuration and use it like @MamdouhSar I do not see this error!
push: {
ios: {
pfx: __dirname + '/certs/' + process.env.APNS_IOS_CERTIFICATE, // The filename of private key and certificate in PFX or PKCS12 format from disk
bundleId: process.env.BUNDLE_ID_IOS, // The bundle identifier associate with your app
production: is_production // Specifies which environment to connect to: Production (if true) or Sandbox
}
// ,osx: {
// pfx: __dirname + '/certs/' + process.env.APNS_OSX_CERTIFICATE, // The filename of private key and certificate in PFX or PKCS12 format from disk
// bundleId: process.env.BUNDLE_ID_OSX, // The bundle identifier associate with your app
// production: is_production // Specifies which environment to connect to: Production (if true) or Sandbox
// }
}
So maybe there is some other issue with the configuration of @MamdouhSar but the error message is not displayed correctly due to babel?
Perhaps an issue with babel, let's see if we can either fix it or remove babel altogether :)
Any update on this?
please update to the latest version of parse-server and open a new issue if needed.
I am running version
1.2.0
of parse-server-push-adapter. I addedosx
push config to my server configuration. Now the app crashes on startup withthrow _iteratorError
.This is how my push config does look like:
All configuration variables are set.
Expected:
parse server push adapter should throw an error that
osx
is unsupported push type as this is only supported with release1.3.0
.Actual result:
It crashes with
throw _iteratorError;
.thoughts:
I think
_iteratorError
in this case is actually the correct error I expect (throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED, 'Push to ' + pushType + ' is not supported');
. However parse server does not print the error correctly to the user as you can see here: https://github.com/ParsePlatform/parse-server/blob/c1dcaf12712eb025d502387e564d3b9c1093a768/src/Adapters/AdapterLoader.jsTherefore I never see the actual error message. Maybe this is an error of
parse-server
in this case.