Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error PUSH ERRORXMLHttpRequest failed: "Unable to connect to the Parse API" when sending push through Curl #1337

Closed
3 tasks done
HemanParbhakar opened this issue Apr 2, 2016 · 4 comments

Comments

@HemanParbhakar
Copy link

Check out this issue for an ideal bug report. The closer your issue report is to that one, the more likely we are to be able to help, and the more likely we will be to fix the issue quickly!

For implementation related questions or technical support, please refer to the Stack Overflow and Server Fault communities.

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

Environment Setup

Steps to reproduce

Logs/Trace

curl -X POST -H "X-Parse-Application-Id: myqappid" -H"X-Parse-Master-Key:mymasterkey" -H "Content-Type: application/json" -d '{"action": "SEND_PUSH", "message": "hello", "customData": "My message"}' http://ipadress:1337/parse/functions/pushChannelTest

Cloud.js__)))_///////

Parse.Cloud.define('pushChannelTest', function(request, response) {

// request has 2 parameters: params passed by the client and the authorized user
var params = request.params;
var user = request.user;

// extract out the channel to send
var action = params.action;
var message = params.message;
var customData = params.customData;

// use to custom tweak whatever payload you wish to send
var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.equalTo("deviceType", "android");

var payload = {"data": {
"alert": message,
"action": action,
"customdata": customData}
};

// Note that useMasterKey is necessary for Push notifications to succeed.

Parse.Push.send({
where: pushQuery, // for sending to a specific channel data: payload,
}, { success: function() {
console.log("#### PUSH OK");
}, error: function(error) {
console.log("#### PUSH ERROR" + error.message);
}, useMasterKey: true});

response.success('success');
});
untitled

@flovilmart
Copy link
Contributor

what's the result of you cURL ? can you run it with curl -vvv -X ... so we have more logs?

@HemanParbhakar
Copy link
Author

Agian same error
heer

@flovilmart
Copy link
Contributor

That wasn't supposed to fix it but to see the logs of the request. Did you set serverURL to the correct value in the index.js?

@HemanParbhakar
Copy link
Author

yes fixed it now
thanxx man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants