Skip to content

Parse Server 2.1.4 on AWS? #916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pushtek opened this issue Mar 8, 2016 · 26 comments
Closed

Parse Server 2.1.4 on AWS? #916

pushtek opened this issue Mar 8, 2016 · 26 comments

Comments

@pushtek
Copy link

pushtek commented Mar 8, 2016

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

@pushtek pushtek changed the title Parse Server on AWS 2.1.4? Parse Server 2.1.4 on AWS? Mar 8, 2016
@occurrentarts
Copy link

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

@andresgarza
Copy link

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.

@pushtek
Copy link
Author

pushtek commented Mar 9, 2016

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.

@occurrentarts
Copy link

@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!

@andresgarza
Copy link

@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:pass@host.com/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
Copy link

@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.

@occurrentarts
Copy link

@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....

@pushtek
Copy link
Author

pushtek commented Mar 9, 2016

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 notifications@github.com
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
#916 (comment)
.

@pushtek
Copy link
Author

pushtek commented Mar 9, 2016

I get the same error. Everything above 2.08 introduces '502 BAD GATEWAY '
On Wed, Mar 9, 2016 at 10:55 AM Antonio Allen antonio97allen15@gmail.com
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 notifications@github.com
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
#916 (comment)
.

@occurrentarts
Copy link

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.

@pushtek
Copy link
Author

pushtek commented Mar 9, 2016

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 notifications@github.com
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
#916 (comment)
.

@occurrentarts
Copy link

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.

@pushtek
Copy link
Author

pushtek commented Mar 9, 2016

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.

@occurrentarts
Copy link

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

@gfosco
Copy link
Contributor

gfosco commented Mar 9, 2016

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 gfosco closed this as completed Mar 9, 2016
@pushtek
Copy link
Author

pushtek commented Mar 9, 2016

@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? aaadesignstudios@gmail.com. Please shoot me an email.

@occurrentarts
Copy link

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:
#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.

@maurovc
Copy link

maurovc commented Mar 16, 2016

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

Thanks!

@occurrentarts
Copy link

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.

@josholdham
Copy link

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.

@poojanjhaveri
Copy link

Yeah. Me too. Were you guys able to get S3 file adapter working with 2.0.x something ? I think it only works on 2.1.x and I cant update that on AWS

@josholdham
Copy link

I think in the end we used the eb command line tools to download a working version from the US location (which we set up using the AWS Deploy button recommended in the Parse migration tutorial), and then initialised a new folder with a copy of these files, setting the geographic region, and then uploading to this new elastic beanstalk instance through the command line.

Details on the command line commands needed can be found here under the Advanced section.

You can then edit your cloud code and deploy straight from that folder.

@Shahid452
Copy link

I also Started having same problem. At very first, it deployed successfully, but after that whenever I try to update, either I get internal server error or Bad gateway 502. Dont know what is the problem.

@greggmojica
Copy link

Any updates on this issue?

@mmislam101
Copy link

This is what helped me:
http://stackoverflow.com/a/29461316/3166719

If you check eb logs, under your ngnix instance you may see logs such as:

2016/06/03 01:52:48 [error] 14108#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.11.39, server: , request: "POST /parse/classes/_Installation HTTP/1.1", upstream: "http://127.0.0.1:8081/parse/classes/_Installation", host: "breathe-parse-server.us-west-1.elasticbeanstalk.com", referrer: "http://0.0.0.0:4040/apps"

The stack overflow answer suggested that you change your express app (or whatever you're using) to listen on port 8081 instead of 1337:

var app = express();
...
app.listen('8081', function() {...

@greggmojica
Copy link

Change the port to 3000. This worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants