Cannot find the correct server path after success deployment to beanstalk

I am not sure about the state of the AWS deploy button, it is something @dblythy may know more about. Not sure about timeline, as I donā€™t know what exactly the issue is.

The serverURL is in the example repo, the publicServerURL isnā€™t. Even if a variable is not in code, if the environment variable is set, the value is added to the Parse Server configuration automatically. The reason why you see some variables in the index.js code is because if they are not set via environment variable, a default value is set for them, otherwise they would just be undefined.

For example, if env var PORT is not set, then in index.js it is set to 1337:

process.env.PORT || 1337;

That doesnā€™t mean that port 1337 is available, or that EB will route incoming requests to that port. It is just a default value that should work in most settings.

Yes. I think your suggestion is really great. I will create a small project and run in EB first to see whether it will work. Thanks a lot!

Iā€™m not an expert on this by any means, but hereā€™s what I normally do.

  • Create a new NodeJS EB Application with AWSā€™ sample code
  • Run eb init on my local machine, followed by eb labs download
  • Copy the code from the Parse Server Example repo into this newly created folder, and have the following in your config:
  appId: process.env.APP_ID,
  databaseURI: process.env.DATABASE_URI,
  masterKey: process.env.MASTER_KEY,
  serverURL: process.env.SERVER_URL,

I normally use dotenv to help me test my Parse Server config locally before I deploy to AWS.

  • I would make sure everything is running properly by running npm start and visiting the local Parse entry point first.
  • Then use eb deploy to deploy your changes.

Hereā€™s how my EB configuration looks:

Note that when I click ā€œgo to environmentā€ I get the entry point for ā€œ/ā€. When I add ā€œ/parseā€ to that url, you should get {"error": "unauthorized"}

AWSā€™ EB logs can generally be pretty helpful to tell you whatā€™s going on. You can access these in EB by going env ā†’ Logs ā†’ Request Logs ā†’ Last 100 Lines.

Bonus points for once you get this up and going, I normally:

  • Create a private repo that is a clone of Parse Server Example
  • Add your keys as GitHub secrets (no secure keys hardcoded)
  • Add a GitHub action to auto deploy your code to EB when master is updated.

In fact, Iā€™ve just tried to boot up a new EB Environment using Parse Server Example ZIP and got the error ā€œInstance deployment: You didnā€™t include a ā€˜package.jsonā€™ file in your source bundle. The deployment didnā€™t install a specific Node.js version.ā€. Investigating now.

Hope to hear more! Thanks a lot for your comments.

Itā€™s also worth noting that when you visit your server URL (http://ec2-161-189-119-69.cn-northwest-1.compute.amazonaws.com.cn), you see the AWS Sample application, which shows that Parse Server didnā€™t properly install.

If you click ā€œgo to environmentā€ and get the entry point for ā€œ/ā€, what will show up? Do you see a html page? How do you add ā€œ/parseā€ to this url? Do you add this by setting PARSE_MOUNT=ā€œ/parseā€?

Also, do you set SERVER_URL=ā€œhttps://url_provided_by_beanstalk/parseā€?

Moreover, you did not set publicServerURL, right?

Thanks

I mean that if your install has worked properly, when you visit http://ec2-161-189-119-69.cn-northwest-1.compute.amazonaws.com.cn/parse, you should see this:

Screen Shot 2021-03-26 at 7.48.41 am.

Parse config isnā€™t going to matter if the code AWS is working off is still the EB sample application.

As far as I can tell, I would guess AWS has failed to install NPM dependancies or some similar error. Iā€™m trying to replicate.

If you click ā€œgo to environmentā€ and get the entry point for ā€œ/ā€, what will show up? Do you see a html page? How do you add ā€œ/parseā€ to this url? Do you add this by setting PARSE_MOUNT=ā€œ/parseā€?

Pls try read what I am writing here :blush:

If Parse Server has installed correctly (and is running properly), you should see ā€œI dream of being a websiteā€, or something like that.

Your site is showing the AWS Sample Application, which means Parse hasnā€™t installed properly. Parse config wonā€™t matter if Parse isnā€™t installed.

Iā€™ll have instructions what youā€™ll need to do in a minute or two.

@Manuel the issue seems to stem from:

  • Node version ā€œ>=4.30ā€ is not supported on AWS. Changing this in package.json to ā€œ12.9.1ā€ seems to solve this issue.
  • NPM throws an install issue from install sub dependancy node-gyp.
  • AWS does not seem to like the GitHub generated .ZIP file and returns ā€œyou must specify a package.jsonā€

@hkblue could you try to deploy off this Parse Server example instead? Iā€™ve made the changes that should fix the underlying issue.

I am trying now. Give one moment.

You mentioned the Node version issue. Do I choose " Node.js 14 running on 64bit Amazon Linux 2/5.3.0" in Beanstalk?

Yep, that is correct! :slight_smile:

Also, do I set SERVER_URL=ā€œhttps://url_provided_by_beanstalk/parseā€?

Thatā€™s how I normally do it

I donā€™t see much difference.
This is what I see after I click ā€œgo to environmentā€:

Also, the post request sent to http://phonecall2.cn-northwest-1.eb.amazonaws.com.cn/parse returns nothing.

Iā€™m assuming here that you had the same error that I did. AWS also seems to not like the .zip file generated by GitHub and errors ā€œyou must specify a package.jsonā€. If you go to logs you can find some information around this.

Can you try install using this ZIP. Rest assured this is just a command line ZIP of my fork of the Parse Server Example repo, but use at your own risk.