Closed
Description
Hello,
To fix this issue, I have checked #575, #564, #401 and #396, but I could not find the resolution.
Here is my code:
main.js
Parse.Cloud.define("SendPush", function(request, response) {
console.log(request.params);
var receiveUser = new Parse.User();
receiveUser.id = request.params.receiveUserId
var query = new Parse.Query(Parse.Installation);
query.equalTo('user', receiveUser);
Parse.Push.send({
where: query,
data: {
alert: request.params.alert,
user_id: request.params.user_id,
type: request.params.type
}
}, {
success: function() {
console.log('##### PUSH OK');
response.success("Push Sent");
},
error: function(error) {
console.log('##### PUSH ERROR: ' + error.message);
response.error("Push Failed");
},
userMasterKey: true
});
});
index.js
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://...',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || '',
masterKey: process.env.MASTER_KEY || '',
fileKey: process.env.FILE_KEY || '',
serverURL: 'http://localhost:1337/parse',
filesAdapter: new S3Adapter(
...
),
push: {
android: {
senderId: '',
apiKey: ''
},
ios: [
{
pfx: __dirname + '/Certificates/Push_Sandbox.p12',
bundleId: '',
production: false
},
{
pfx: __dirname + '/Certificates/Push_Production.p12',
bundleId: '',
production: true
}
]
}
});
When calling this on client app(iOS version), I get error message on my terminal.
##### PUSH ERROR: Master key is invalid, you should only use master key to send push
I am testing on my mac.
If you have the another resolution, please let me know about it.
Thanks,
Martin
Metadata
Metadata
Assignees
Labels
No labels