1

I am trying to deploy my newly written cloud code function to Parse but I keep getting the error "Unexpected identifier" at line 110, I can't seem to figure out how there is an error here, any help?

Parse.Cloud.define("backgroundJob", function(request, response) {
Parse.Cloud.useMasterKey();

var moments = require("cloud/moments.js");

var now = moments.moment();
var groupObject = Parse.Object.extend("Group");
var query = new Parse.Query(groupObject);

var eventObject = Parse.Object.extend("Event");

query.find().then(function(groups) {
    var promise = Parse.Promise.as();
    _.each(group, function(result) {
        promise = promise.then(function() {
            var count = 0;
            var events = _.map(result.get("Events"), function(eventArray) {
                if (now == eventArray[count].get('date') {

                var curEvent = eventArray[count];
                eventArray[count].destory();

                var relationc = result.get("created");

                var createdq = relationc.query();

                var relationj = result.get("created");

                var joinedq = relationj.query();

                var partOnee = curEvent.get("name");
                var outString = partOnee.concat(" is now");

                Parse.Push.send({
                    where: createdq,
                    data: {
                        alert: outString
                    }
                }).then(function() {
                    response.success();
                }, function(error) {
                    response.error(error);
                });

                Parse.Push.send({
                    where: joinedq,
                    data: {
                        alert: outString
                    }
                }).then(function() {
                    response.success();
                }, function(error) {
                    response.error(error);
                });

                }

                count = count+1;
            });

        });
    });
}).then(function() {
    response.success()
}, function(error) {
    response.error(error);
});
});

Line 110 is var curEvent = eventArray[count];

1 Answer 1

3

You missed ) in this line if (now == eventArray[count].get('date'), see:

        var events = _.map(result.get("Events"), function(eventArray) {
            if (now == eventArray[count].get('date') {

Fix:

        var events = _.map(result.get("Events"), function(eventArray) {
            if (now == eventArray[count].get('date')) {

Note, when interpreters/compilers (in most programming languages) say there is a problem on a line, usually the problem can be in any row before.

Sign up to request clarification or add additional context in comments.

1 Comment

Oh didn't catch that one, thanks. I assumed the error would be on that exact line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.