Skip to content

Occasional "Missing push configuration" error #2439

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

Closed
royherma opened this issue Aug 2, 2016 · 5 comments
Closed

Occasional "Missing push configuration" error #2439

royherma opened this issue Aug 2, 2016 · 5 comments

Comments

@royherma
Copy link

royherma commented Aug 2, 2016

I've been able to set up parse server push notifications on my Ubuntu backend, however I seem to be running into an issue which results in the "Missing push configuration" error. I've definitely been able to send and receive push notifications at certain times, but at other times I am running into that error. I'm not changing the parse environment file, but rather only conducting changes the main.js cloud code file, which does seem to affect it oddly enough. I get the error both in the parse-dashboard when trying to send to all users, and in the xcode console when running a more targeted push function using a custom cloud code method. It is here below btw:

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

    var Person = Parse.Object.extend("Person");
    var person = new Person();
    person.id = request.params.person;

    // Find devices associated with these users
    var pushQuery = new Parse.Query(Parse.Installation);
    pushQuery.equalTo("person",person);
    console.log("enterred send push to person");
    Parse.Push.send({
      where: pushQuery, // Set our Installation query
      data: {
        alert: "Willie Hayes injured by own pop fly."
      }
    },
     {
      success: function() {
        console.log("push sucess");
        // Push was successful
        response.success();
      },
      error: function(error) {
        // Handle error
        response.error("Error: " + error.code + " " + error.message);           
        console.log("push failure " + error.message);
      }, useMasterKey: true });
});

It is being called in on the client as so:

[PFCloud callFunctionInBackground:@"sendPostToPerson" withParameters:@{ @"person" : person.pfObject.objectId,
                                                                          @"data" : data }
                              block:^(id _Nullable object, NSError *_Nullable error) {
                                if (!error) {
                                  NSLog(@"sucesfully sent push %@", data);
                                } else {
                                  NSLog(@"error sending push %@", error.localizedDescription);
                                }
                              }];

The bottom line is that I am unable to understand the relation of the error message and the main.js (seems to me that they should not affect one another, at least when I am using the parse dashboard to send a push and not the cloud code). Anybody run into this issue, or has an idea what exactly is happening here?

Thanks!

@royherma
Copy link
Author

royherma commented Aug 3, 2016

It seems to somewhat be related to the fact that I can't get some of my subclassed PFObjects' properties (in other cloud methods). If I have:

Parse.Cloud.beforeSave("PostView", function(request, response) {
    var person = request.object.get("viewedBy");
    var post = request.object.get("post");
        var story = post.get("story"); <--- this doesn't seem to work
    var PostView = Parse.Object.extend("PostView");
    var query = new Parse.Query(PostView);

Does a before/after save request not contain its object's object's sub properties?

@joeyslack
Copy link

Is your request.object.get('post') a pointer? What type of object is post? If it's not just raw data, you'll need to hydrate it with a query with proper includes.

@royherma
Copy link
Author

yes, its a pointer. So you mean I should first fetch the post from the DB and then get it's story?

@joeyslack
Copy link

joeyslack commented Aug 11, 2016

@royherma Yes, it would seem that you'll have to query the story separately. The good news is that you should have the ID of the object in the pointer, so should be very easy to get the proper story object using that ID.

@royherma
Copy link
Author

yeah, that won't be a problem - its more of a speed/usage thing, i.e would have been way faster if i can directly access the pointer object's properties (which are being sent from the client end). Thanks joey 👍

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