Skip to content

Parse cloud code strange error #535

Closed

Description

@martinappberg

This cloud code function has been working perfectly until all of the sudden it gives me code: 141 error no reason and no description. It was working until I published a testflight and had two devices run the function after eachother. I run a ParseServer on Heroku with mongodb as database. I use masterkey and also have defined my server.

Parse.Cloud.define("ReadyUp", function(request, response) {
    Parse.Cloud.useMasterKey();
        var fbid = request.user.get("fbid");
        var query = new Parse.Query("Spel");
        query.equalTo("lobby", fbid);
        query.find().then(function(results) {
            results[0].addUnique("ready", fbid);
            return Parse.Object.saveAll(results);
        }).then(function(result) {
            response.success(result);
        }, function(error) {
            response.error(error);
        });
    });

This is the code to call the function from ios app:

    [PFCloud callFunctionInBackground:@"ReadyUp" withParameters:@{@"fbid":[[PFUser currentUser]objectForKey:@"fbid"]}
                                block:^(NSString *response, NSError *error) {
                                    if (!error) {
                                    }else {
                                        NSLog(@"%@",[error description]);
                                        [self fixParseBugsforUpdateWithLobby:nil];
                                    }
                                }];

Please, any ideas? I'm starting to rip out my hair...

Activity

  1. tanmays commented on Feb 20, 2016

    @tanmays

    Parse.Cloud.useMasterKey(); is no longer supported. The correct way to use the master key would be:

    Parse.Cloud.define("ReadyUp", function(request, response) {
            var fbid = request.user.get("fbid");
            var query = new Parse.Query("Spel");
            query.equalTo("lobby", fbid);
            query.find({useMasterKey:true}).then(function(results) {
                results[0].addUnique("ready", fbid);
                return Parse.Object.saveAll(results, {useMasterKey:true});
            }).then(function(result) {
                response.success(result);
            }, function(error) {
                response.error(error);
            });
        });
    
  2. gfosco commented on Feb 20, 2016

    @gfosco
    Contributor

    @tanmays is correct. Please re-open if you have any issues. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions