4

So I created my Parse Server on AWS EB using the press button method here:

https://github.com/ParsePlatform/parse-server-example

And then it set up and was running fine. I then created a directory on my local machine (I already have EB CLI installed) and ran the following commands, names changed and some lines left out for privacy purposes:

mkdir myparseservernames
cd myparseservernames
eb init
eb labs download

Then I went into the cloud folder and changed main.js to say this:

Parse.Cloud.define('hello', function(req, res) {
  res.success('Hi');
});

require('cloud/myjobs.js');

Then I created my my jobs.js file and made it say:

Parse.Cloud.job('deleteOldPosts', function(request, status) {
    // All access
    Parse.Cloud.useMasterKey();

    var today = new Date();
    var days = 0;
    var time = (days * 24 * 3600 * 1000);
    var expirationDate = new Date(today.getTime() - (time));

    var query = new Parse.Query('gameScore');
    query.lessThan('createdAt', expirationDate);
    query.each(function(post) {
        return post.destroy();
    }).then(function() {
        console.log("Delete job completed.");
        status.success("Delete job completed.");
    }, function(error) {
        alert("Error: " + error.code + " " + error.message);
        status.error("Error: " + error.code + " " + error.message);
    });
});

Then I backed out into the root folder and did 'eb deploy' and it uploaded to my AWS server. Now I am getting a 502 Bad Gateway error when clicking the environment URL. Does anyone know why this might be and what a fix is?

Joe
  • 157
  • 1
  • 12

0 Answers0