Ad

Uncaught SyntaxError: Unexpected Token ILLEGAL In Main.js:4

Using the command line to update Parse Cloud Code to the following. Getting this error for some reason. Getting uncaught syntax error:Unexpected ILLEGAL on line 4. Command line says finished uploading files, however, this error is printed immediately right below and parse cloud code is not updated.

// Use Parse.Cloud.define to define as many cloud functions as you want.
// For example:

Parse.Cloud.define("hello", function(request, response) {
     response.success(“Hello, PARSE Cloud coming back”);
});

var express = require("express"),
    app = express(),
    crypto = require('crypto'),
    buffer = require('buffer'),
    url = require('url');

var config = new Parse.Object("Config");
config.set("client_id", "");
config.set("client_secret", "");
config.set("callback_url", "");
config.set("endpoint", "");

var AUTH_HEADER = "Basic " + new buffer.Buffer(config.get("client_id")      + ":" + config.get("client_secret")).toString("base64");

app.use(express.bodyParser());

Parse.Cloud.define("swap", function (req, res) {
    if (!req.body || !req.body.hasOwnProperty("code")) {
        res.status(550).send("Permission Denied");
        return;
}

var form_data = {
    "grant_type": "authorization_code",
    "redirect_uri": config.get("callback_url"),
    "code": req.body.code
};

Parse.Cloud.httpRequest({
    method: "POST",
    url: url.resolve(config.get("endpoint"), "/api/token"),
    headers: {
        "Authorization": AUTH_HEADER,
        "Content-Type": "application/x-www-form-urlencoded"
    },
    body: form_data,
    success: function(httpResponse) {
        if (httpResponse.status != 200) {
            res.status(550).send("Permission Denied");
            return;
        }

        var token_data = JSON.parse(httpResponse.text);

        res.status(200).set({
            "Content-Type": "application/json"
        }).send(token_data);
    },
    error: function(httpResponse) {
        res.status(500).send("Internal Server Error");
        return;
    }
  });
});
Ad

Answer

The quotes in the second line are not valid tokens, so the compiler doesn't understand them:

Parse.Cloud.define("hello", function(request, response) {
     response.success(“Hello, PARSE Cloud coming back”); //Those quotes.
});

Change the with the normal " and you're good to go!

Ad
source: stackoverflow.com
Ad