[SOLVED] Site can't be reached Beanstalk

Hi!

I’m attempting to deploy a Meteor app to AWS Beanstalk.

Beanstalk supports Node 10 and above. My app was currently on Meteor 1.8.3 (Node 8). I updated the app to 1.9 to get it to Node 12.14.0. This involved a lot of tedious installation on Windows with VS Build Tools and Node-GYP. Then - I had to “shrinkwrap” fourseven:scss to 4.12.0 to finally get the app to build.

I was able to run the build locally which was great.

However, upon deploying to Beanstalk…I get the Chrome error for " This site can’t be reached"…“took too long to respond.”…

The app sits behind an NGINX Reverse Proxy. I set ROOT__URL to be the domain given to me by Beanstalk. PORT is not set, meaning it defaults to 80 (which is open in inbound traffic on the Security Group).

There are no errors on either the Node logs or NGINX ones. I can see my request coming in to NGINX access log though.

I inserted some debugging in the main.js file to to prove that the Meteor server has in fact loaded on the EC2 instance and have confirmed that I’m seeing this.

So - it seems like everything is actually up and running, but that the client cannot interact with the Meteor Server.

Strangely enough, I deployed a meteor example app (using the latest version with Node 14) and it works. Same configurations here too, I just set ROOT_URL and MONGO_URL, but not PORT.

I’m trying to update my app to Meteor 2.3 rc to try it out with Node 14 but keep running into package restraints atm.

Any ideas on why I can’t even see the app through Beanstalk? I’ve tried using Apache instead of NGINX and even removing the reverse proxy to no avail. Thanks!

For starters let’s try updating your app just to 2.2 and see if that fixes the issue.

1 Like

I’ll try that now, thanks!

I keep running into issues with running node main.js in the created bundle. Here’s what I’m doing

//Update app to 2.2
1.meteor update --release 2.2

//Build app
2. meteor build ..\ --directory --server-only --architecture os.linux.x86_64

//Install deps
3. cd …\bundle\programs\server && meteor npm install

//Add ROOT_URL & MONGO_URL
// I hardcode these in main.js just for testing

Running node main.js from within the \bundle dir gives me
`"Error:
The @babel/runtime npm package could not be found in your node_modules
directory. Please run the following command to install it:

meteor npm install --save @babel/runtime"`

I then run ^ within programs\server.

Running node main.js again then gives me
Error: Cannot find module 'simpl-schema'

I then run meteor npm install simpl-schema from programs\server.

Running node main.js from here then gives me the same "“Error:
The @babel/runtime npm package could not be found in your node_modules
directory. Please run the following command to install it” error.

It keeps going back-and-forth with these dependencies.

I did not have the same issue when updating to 1.9

Thanks!

I finally got app updated to 2.2 and running locally. I had to run meteor npm install in root dir prior to building too. Then - there were some issues with plugins that I was able to fix using [2.1.1] SpacebarsCompiler is not defined · Issue #11387 · meteor/meteor · GitHub .

I’ve successfully been able to deploy to EB with 2.2 and Node 12.22.1. The Meteor server still appears to be launching successfully as I can see some debugging in node console logs.

This time however, I get a 502 Bad Gateway error from NGINX. This is shown in the nginx error logs too.

node.js - NodeJS connect() failed (111: Connection refused) while connecting to upstream - Stack Overflow seems to be the problem.

NGINX seems to be trying to forward client requests to the actual upstream ec2 Meteor Node instance at 127.0.0.1:8001.

Putting in 8001 as PORT Env Var didn’t resolve this either.

At this point, I figured maybe NGINX was complicating things and wanted to test removing the reverse proxy again. Removing it then gave me the same ‘site can’t be reached’ error in Chrome.

This leads me to believe that while Meteor may be “running”, that it’s not returning responses to downstream if that makes any sense.

I have npm start as my node command. In package.json this calls node main.js.
I’ve also tried using just node main.js to no avail.

Any ideas?

1 Like

I understand there are other complications with websockets regarding NGINX. I just want to see the login page for my app first though. I’m seeing this when running it locally via node main.js, so I don’t think it’s anything specific with the app logic just yet.

Ah, Meteor example app is actually running on beta 2.3 and thus uses Node 14 (latest Beanstalk version too). I’m gonna try updating my app to this again and see what happens

I’m attempting to update to 2.3-rc2 but am running into issues with accounts and http

Conflict: Constraint accounts-base@1.1.3 is not satisfied by accounts-base 2.0.0-rc230.2
Constraint http@1.0.10 is not satisfied by http 2.0.0-rc230.2.
Conflict: Constraint accounts-password@1.1.1 is not satisfied by accounts-password 2.0.0-rc230.2

Update: Got it working! NGINX was showing 302s. I had assumed it was EB attempting the http->https redirect, but the force-ssl package was doing it.

Removing that made it work.

1 Like