parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Parse Server 2.1.4 on AWS?

Open pushtek opened this issue 10 years ago • 26 comments

How should we go about getting the latest parse version on AWS?

pushtek avatar Mar 08 '16 15:03 pushtek

Has anyone succeeded with this? Anything over 2.08 gives me a '503 Bad Gateway' error.

occurrentarts avatar Mar 09 '16 04:03 occurrentarts

I have succesfully deployed 2.1.4 to AWS using elastic beanstalk. That said, I do have a custom version of the parse-server example. I would advise checking the node/npm logs of your instance. If you are using Elastic Beanstalk, bad gateway usually means your node app did not start correctly.

andresgarza avatar Mar 09 '16 05:03 andresgarza

Is it possible that you can share your custom version .zip? I've downloaded the logs, but I'm not sure exactly what I should be looking for.

pushtek avatar Mar 09 '16 05:03 pushtek

@andresgarza if the node app didn't start correctly, how do you get it to start? i tried to access the instance via 'eb ssh' but 'npm start' throws errors:

DATABASE_URI not specified, falling back to localhost.

and

You must provide a serverURL!

occurrentarts avatar Mar 09 '16 05:03 occurrentarts

@occurrentarts you are missing both the DATABASE_URI and SERVER_URL environment variables. The first one is the connection string for your database, i.e. mongodb://user:[email protected]/dbname and the second one is the URL which will be used by Cloud Code functions to make requests against. (e.g http://myparseserver.us-east-1.elasticbeanstalk.com/parse)

You can setup these environment variables both through the AWS console or using the aws cli.

andresgarza avatar Mar 09 '16 06:03 andresgarza

@pushtek my custom version is basically the example one, just running on my existing express server.

Just look for the node logs and see if there are any errors there.

andresgarza avatar Mar 09 '16 06:03 andresgarza

@andresgarza I have these environment variables set in the configuration on the EBS.

How do I set them from the CLI?

Parse-Server 2.08 works fine, but upgrading to 2.10 or above ( to 2.14 current ) introduces the 'Bad Gateway' error....

occurrentarts avatar Mar 09 '16 15:03 occurrentarts

I set them from the CLI but it still doesn't work. You have to install the terminal commands http://aws.amazon.com/cli/ On Wed, Mar 9, 2016 at 10:34 AM occurrentarts [email protected] wrote:

@andresgarza https://github.com/andresgarza I have these environment variables set in the configuration on the EBS.

How do I set them from the CLI?

Parse-Server 2.08 works fine, but upgrading to 2.10 or above ( to 2.14 current ) introduces the 'Bad Gateway' error....

— Reply to this email directly or view it on GitHub https://github.com/ParsePlatform/parse-server/issues/916#issuecomment-194348595 .

pushtek avatar Mar 09 '16 15:03 pushtek

I get the same error. Everything above 2.08 introduces '502 BAD GATEWAY ' On Wed, Mar 9, 2016 at 10:55 AM Antonio Allen [email protected] wrote:

I set them from the CLI but it still doesn't work. You have to install the terminal commands http://aws.amazon.com/cli/ On Wed, Mar 9, 2016 at 10:34 AM occurrentarts [email protected] wrote:

@andresgarza https://github.com/andresgarza I have these environment variables set in the configuration on the EBS.

How do I set them from the CLI?

Parse-Server 2.08 works fine, but upgrading to 2.10 or above ( to 2.14 current ) introduces the 'Bad Gateway' error....

— Reply to this email directly or view it on GitHub https://github.com/ParsePlatform/parse-server/issues/916#issuecomment-194348595 .

pushtek avatar Mar 09 '16 15:03 pushtek

Even when I try and start fresh with: https://github.com/ParsePlatform/parse-server-example

I encounter errors:

ERROR: "option_settings" in one of the configuration files failed validation. More details to follow. ERROR: Unknown or duplicate parameter: NodeCommand ERROR: Failed to launch environment.

occurrentarts avatar Mar 09 '16 15:03 occurrentarts

Yes if I upload parse-server-example.zip right from github I get a degraded red status. On Wed, Mar 9, 2016 at 10:58 AM occurrentarts [email protected] wrote:

Even when I try and start fresh with: https://github.com/ParsePlatform/parse-server-example

I encounter errors:

ERROR: "option_settings" in one of the configuration files failed validation. More details to follow. ERROR: Unknown or duplicate parameter: NodeCommand ERROR: Failed to launch environment.

— Reply to this email directly or view it on GitHub https://github.com/ParsePlatform/parse-server/issues/916#issuecomment-194361342 .

pushtek avatar Mar 09 '16 16:03 pushtek

I think the issue is that they introduced the need for the serverURL string in the

var api = new ParseServer({

initialization of index.js in version 2.1.0 , which causes the errors.

add:

serverURL: 'http://localhost:1337/parse'

to the bottom of the new ParseServer arguments and you should be able to get 2.1.4 up and running.

occurrentarts avatar Mar 09 '16 18:03 occurrentarts

Should I download a fresh version from GitHub, make the changes in index.js, then use the "Upload and Deploy" button in my Environment? Or how did you do it? I just change the SERVER_URL in my Configuration on AWS and I got the same error.

pushtek avatar Mar 09 '16 19:03 pushtek

you might be able to just modify the application you use which works on 2.08. add the serverURL to your ParseServer call as indicated below:

var api = new ParseServer({ databaseURI: my-mongolabs-string', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/main.js', appId: process.env.APP_ID || '<appID>', fileKey: 'my-file-key', masterKey: process.env.MASTER_KEY || '<masterKey>', clientKey: 'my-client-key', restAPIKey: 'my-rest-api-key', serverURL: 'http://localhost:1337/parse' }); then

npm install

then commit with git, then

eb deploy

occurrentarts avatar Mar 09 '16 19:03 occurrentarts

My suggestion here would be to not use AWS unless you're an expert and can dive in and troubleshoot these things on your own. You should start with running it locally, then move to using Heroku or Digital Ocean. It won't be possible for us to handle installation support for every available platform, and I think it's overkill to try using AWS for your first development deployment.

gfosco avatar Mar 09 '16 19:03 gfosco

@occurrentarts Still 502.

Here's my package.json: { "name": "parse-server-example", "version": "2.1.4", "description": "An example Parse API server using the parse-server module", "main": "index.js", "repository": { "type": "git", "url": "https://github.com/ParsePlatform/parse-server-example" }, "license": "MIT", "dependencies": { "express": "~4.2.x", "kerberos": "~0.0.x", "parse": "~1.6.12", "parse-server": "~2.1.4" }, "scripts": { "start": "node index.js" }, "engines": { "node": ">=4.1" } }

Here's my index.js: `// Example express application adding the parse-server module to expose Parse // compatible API routes.

var express = require('express'); var ParseServer = require('parse-server').ParseServer;

var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI

if (!databaseUri) { console.log('DATABASE_URI not specified, falling back to localhost.'); }

var api = new ParseServer({ databaseURI: my-mongolabs-string', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/main.js', appId: process.env.APP_ID || '', fileKey: 'my-file-key', masterKey: process.env.MASTER_KEY || '', clientKey: 'my-client-key', restAPIKey: 'my-rest-api-key', serverURL: 'http://localhost:1337/parse' }); // Client-keys like the javascript key or the .NET key are not necessary with parse-server // If you wish you require them, you can set them as options in the initialization above: // javascriptKey, restAPIKey, dotNetKey, clientKey

var app = express();

// Serve the Parse API on the /parse URL prefix var mountPath = process.env.PARSE_MOUNT || '/parse'; app.use(mountPath, api);

// Parse Server plays nicely with the rest of your web routes app.get('/', function(req, res) { res.status(200).send('I dream of being a web site.'); });

var port = process.env.PORT || 1337;

app.listen(port, function() { console.log('parse-server-example running on port ' + port + '.'); }); `

Am I doing something wrong? Is it possible you can share your server.zip? [email protected]. Please shoot me an email.

pushtek avatar Mar 09 '16 19:03 pushtek

actually, try switching:

serverURL: 'http://localhost:1337/parse'

to:

serverURL: 'your-server-url/parse'

before you deploy?

also, just learned that Parse.Cloud.useMasterKey(); is no longer supported above 2.08, so be sure to change that in your cloud code as noted in: https://github.com/ParsePlatform/parse-server/issues/535

@gfosco "It won't be possible for us to handle installation support for every available platform"

Because the open source 'parse-server' software seems to continue to have issues, its not entirely clear which issues are because of bugs and which issues are service issues.

It would be super irresponsible for your team to refuse support to AWS installation issues seeing as you're promoting it as one of your 3 suggested platforms for transition in the migration guide.

occurrentarts avatar Mar 09 '16 20:03 occurrentarts

I'm dealing with the same problem with no luck. Did you finally found the solution?

Thanks!

maurovc avatar Mar 16 '16 18:03 maurovc

Was able to get past 2.08 with the serverURL tactic above, but experienced issues with 2.1.4 and 2.1.5 I ended up reverting to 2.1.3 which seems to be working alright.

occurrentarts avatar Mar 16 '16 19:03 occurrentarts

I am also having this problem, and am unable to test the serverUrl tactic. As I want to deploy to a specific geographic region (Ireland) I am using the eb command line tools, and do not know my server url before deployment.

josholdham avatar Mar 18 '16 11:03 josholdham