Deploying on beanstalk with express 4 build - node.js

I followed the instructions here http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_express.html and it works fine if I use the aws examples.
But when I tried it by myself, the basic Express skeleton, expected to give an output of "Express \n Welcome to Express", isn't working and is giving a 502 Bad Gateway error.
I noticed that my build is with Express 4.2 whereas the aws examples use Express 3.x.
From the beanstalk logs:
2014/06/28 03:41:57 [error] 1930#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xx.xxx.xx, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8081/", host: "my-env-xxxxxxxxxn.elasticbeanstalk.com"
There is no database, and no code changed from the skeleton generated by express.
(And btw, it works just fine if I do a npm start locally on my mac)
Please help.
Update: The solution mentioned in the link below answer works in this case.
502 Bad Gateway Deploying Express Generator Template on Elastic Beanstalk
Though it is not clear to me exactly why AWS would execute in that order.

Related

502 Bad Gateway nginx/1.10.3 (Ubuntu) - Angular app down

I have an website in Angular hosted on AWS. On my local machine, the app works with npm start. However, when I ssh and update the changes I get an 502 Bad Request Error. It looks like this might be a dependency issue. Do you know know to troubleshoot this?

504 Gateway Timeout error with NuxtJS application running on Nginx

I have a Nuxt JS SSR site hosted on digital ocean. I am using nginx as reverse proxy with configuration as described at Nuxtjs website. I also use pm2 to run nuxt app. Everything works fine until I gat 504 and 502 errors. When I check ngnix logs it shows erros like this:
"[error] 2767773#2767773: *1655282 upstream timed out (110: Connection
timed out) while reading response header from upstream, client:
x.x.x.x, server: leadersport.ge, request: "GET /news/devils HTTP/1.1",
upstream: "http://x.x.x.x:8000/xxxx/xxxx", host: "xxx.com"
It seems like there is problem with Nuxtjs app. I inspected my Nuxtjs application(I use pm2 monit, and also I log every error inside my nuxtjs app) but it seems to work fine. After 504 error I check nuxtjs logs and there seems to be no problem. Could it be that I miss something regarding nuxtjs app? If so how could I find out what is exactly the problem with nuxtjs app? Or could it be the problem with nginx configuration?
I also check memory and cpu usage and it seems to be okay.

Error on EB AWS - 502 Bad Gateway nginx/1.18.0

I have a problem regarding my Node app that I am running in AWS. Everything has been working fine until today.
Without any new deployment to the app, I am getting this 502 error when I try to access the URL.
I have checked the nginx logs, and Im getting this:
2020/10/11 01:24:55 [error] 4735#0: *1 connect() failed (111: Connection refused) while connecting to upstream, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8080/favicon.ico", host: "mydomain.com", referrer: "mydomain.com"
I have tried to create a new security group with new inbound rules but it didnt work, has there been ane "new" update on EB configuration Im missing?
Thanks in advance.
enter image description hereIf you are using python > 3.6 on eb. Then eb will use gunicorn to run your django app.
So you need to install gunicorn with pip install gunicorn also mention it in requirements.txt with pip freeze requirements.txt and most important thing is You need to create "Procfile" in your project root where manage.py is located.
"Procfile" will have no extension.
"Procfile" content is below:
web: gunicorn --bind :8000 --workers 3 --threads 2 ebdjango.wsgi:application
in place of ebdjango put you project name and deploy with eb deploy.
Thanks!
I got exactly the same problem exactly at the same time than you. My solution was to remove the start of the program from index.js to the app.js. After that everything works fine again. For the some reason aws does not start index.js file anymore.

Google app engine error the server encountered a temporary error and could not complete your request

I am using Google app engine and previously everything was working fine but now when I am trying to deploy my app then i am facing this error.
Then i tried to see in my logs and in logs i found the error logs were
[error] 32#32: *2211 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 130.211.0.251, server: , request: "GET /_ah/health HTTP/1.1", upstream: "http://172.17.0.1:8080/_ah/health", host: "10.142.0.4"
Why am I getting this error? Previously everything was working fine and I haven't changed anything in my code.
I have also seen this SO post /appengine-nodejs-random-the-server-encountered-a-temporary-error-and-could-not but i cannot delete all versions of my app engine and try again.
I don't know why but problem was occuring because i was running my nodejs app on Port 3000, but as i changed it to 8080 now it is working fine. I think default port google cloud uses is 8080 maybe.

Angular 2 Routing with Amazon EC2 404 error

I am trying to get a deployment of a MEAN stack app using angular2 v1.0.0 beta.3 up and running. Everything is going well so far except this annoying routing issue that did NOT occur when I deployed to Heroku. However; this is my first experience deploying to ec2 using elastic beanstalk.
When I open up the route at the base route / the page loads as normal and I can use the app as if nothing is wrong. However, if I navigate to a subroute, in my case /client/issue/:id , the state loads, but if I reload the page I will get a 404 ERROR. In my server.js I have what I thought was a 404 catch app.get('*', loadIndex'), but this does not seem to be the case. I assume it is an issue with the way ec2 handles routing, but I am not sure.
EDIT
It might also be worth noting that I am only getting an error in my /var/log/nginx/error.log file and not the /var/log/nodejs/nodejs.log file.
From the error.log file:
2016/04/06 15:14:00 [error] 18952#0: *16 open() "/var/app/current/client/Issue/yes/57044092fe1924e77d9049ab" failed (2: No such file or directory), client: 172.31.4.202, server: , request: "GET /client/Issue/yes/57044092fe1924e77d9049ab HTTP/1.1",

Resources