AWS Elasticbeanstalk + Docker + Nginx + Node/Express 502 Bad GatewayNginx: 502 Bad GateWay502 Bad Gateway...
How much do grades matter for a future academia position?
What should be the ideal length of sentences in a blog post for ease of reading?
Ways of geometrical multiplication
The Digit Triangles
Do you waste sorcery points if you try to apply metamagic to a spell from a scroll but fail to cast it?
Should I warn a new PhD Student?
Why the "ls" command is showing the permissions of files in a FAT32 partition?
Mimic lecturing on blackboard, facing audience
Given this phrasing in the lease, when should I pay my rent?
El Dorado Word Puzzle II: Videogame Edition
Why does the Persian emissary display a string of crowned skulls?
Air travel with refrigerated insulin
What the heck is gets(stdin) on site coderbyte?
Showing mass murder in a kid's book
Origin of pigs as a species
Typing CO_2 easily
Do I have to take mana from my deck or hand when tapping a dual land?
What happens if I try to grapple an illusory duplicate from the Mirror Image spell?
Can you identify this lizard-like creature I observed in the UK?
Language involving irrational number is not a CFL
Why didn’t Eve recognize the little cockroach as a living organism?
Alignment of six matrices
Why would five hundred and five be same as one?
Can I say "fingers" when referring to toes?
AWS Elasticbeanstalk + Docker + Nginx + Node/Express 502 Bad Gateway
Nginx: 502 Bad GateWay502 Bad Gateway NginxDocker + nginx + Php-FPM 502 Bad Gateway502 Bad gateway - nginx, uwsgi+django in seperate docker containersDocker: Nginx and hhvm socket configuration returns 502 Bad Gatewayelastic beanstalk docker nginx uwsgi django in same container giving 502 bad gateway error502 Bad Gateway on NginxUsing ebextensions with Docker in AWS Elasticbeanstalk502 Bad gateway nginx ubuntuDocker: nginx as proxy returns a 502 Bad Gateway
I have pushed all this code to my Github repo, TravisCI built a test image and tested my code, it passed the test. TravisCI then built production images, TravisCI pushed the production builds over to my Docker Hub and over to AWS Elasticbeanstalk, EB then presumably pulled the images from my Docker Hub and deployed it.
I am getting a 502 Bad Gateway on my application and I looked at the EB Logs and I believe this is the problem:
/var/log/containers/server-8b2907355681-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ error: password authentication failed for user "Postgres"
at Connection.parseE (/app/node_modules/pg/lib/connection.js:553:11)
at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:378:19)
at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:119:22)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 104,
severity: 'FATAL',
code: '28P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '328',
routine: 'auth_failed' }
However, I have corrected the password inside of EB Configuration to match exactly the one docker-compose.yml
file:
api:
build:
dockerfile: Dockerfile.dev
context: ./server
volumes:
- /app/node_modules
- ./server:/app
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- PGUSER=postgres
- PGHOST=postgres
- PGDATABASE=postgres
- PGPASSWORD=password_protected
- PGPORT=5432
I have tried changing Postgres
to postgres
inside the Elasticbeanstalk environment variables but that has not resolved the issue. I am still getting error: password authentication failed for user "Postgres"
I then deleted RDS instance and provisioned a new with the same exact username and password, case sensitive and all. I added that RDS to the Security Group, I am still getting a 502 Bad Gateway with the same error of:
/var/log/containers/server-8b2907355681-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ error: password authentication failed for user "Postgres"
at Connection.parseE (/app/node_modules/pg/lib/connection.js:553:11)
at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:378:19)
at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:119:22)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 104,
severity: 'FATAL',
code: '28P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '328',
routine: 'auth_failed' }
I provisioned a new PostgreSQL RDS for the third time, ensured that all username and passwords were the same including case sensitive and eliminated any special characters and this time not only did I still get the same error, I also got this one:
-------------------------------------
/var/log/containers/server-09be251b359b-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ Error: connect ETIMEDOUT 172.31.82.39:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: '172.31.82.39',
port: 5432 }
I don't have much else to go on except a 502 Bad Gateway is coming from Nginx and I am wondering if the issue lies in my Nginx configuration. Inside my Nginx service I have the default.conf
file:
upstream client {
server client:3000;
}
upstream api {
server api:5000;
}
server {
listen 80;
location / {
proxy_pass http://client;
}
location /sockjs-node {
proxy_pass http://client;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /api {
rewrite /api/(.*) /$1 break;
proxy_pass http://api;
}
}
Is there anything about this that AWS RDS or EB does not like?
nginx amazon-web-services docker elastic-beanstalk docker-compose
add a comment |
I have pushed all this code to my Github repo, TravisCI built a test image and tested my code, it passed the test. TravisCI then built production images, TravisCI pushed the production builds over to my Docker Hub and over to AWS Elasticbeanstalk, EB then presumably pulled the images from my Docker Hub and deployed it.
I am getting a 502 Bad Gateway on my application and I looked at the EB Logs and I believe this is the problem:
/var/log/containers/server-8b2907355681-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ error: password authentication failed for user "Postgres"
at Connection.parseE (/app/node_modules/pg/lib/connection.js:553:11)
at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:378:19)
at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:119:22)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 104,
severity: 'FATAL',
code: '28P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '328',
routine: 'auth_failed' }
However, I have corrected the password inside of EB Configuration to match exactly the one docker-compose.yml
file:
api:
build:
dockerfile: Dockerfile.dev
context: ./server
volumes:
- /app/node_modules
- ./server:/app
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- PGUSER=postgres
- PGHOST=postgres
- PGDATABASE=postgres
- PGPASSWORD=password_protected
- PGPORT=5432
I have tried changing Postgres
to postgres
inside the Elasticbeanstalk environment variables but that has not resolved the issue. I am still getting error: password authentication failed for user "Postgres"
I then deleted RDS instance and provisioned a new with the same exact username and password, case sensitive and all. I added that RDS to the Security Group, I am still getting a 502 Bad Gateway with the same error of:
/var/log/containers/server-8b2907355681-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ error: password authentication failed for user "Postgres"
at Connection.parseE (/app/node_modules/pg/lib/connection.js:553:11)
at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:378:19)
at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:119:22)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 104,
severity: 'FATAL',
code: '28P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '328',
routine: 'auth_failed' }
I provisioned a new PostgreSQL RDS for the third time, ensured that all username and passwords were the same including case sensitive and eliminated any special characters and this time not only did I still get the same error, I also got this one:
-------------------------------------
/var/log/containers/server-09be251b359b-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ Error: connect ETIMEDOUT 172.31.82.39:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: '172.31.82.39',
port: 5432 }
I don't have much else to go on except a 502 Bad Gateway is coming from Nginx and I am wondering if the issue lies in my Nginx configuration. Inside my Nginx service I have the default.conf
file:
upstream client {
server client:3000;
}
upstream api {
server api:5000;
}
server {
listen 80;
location / {
proxy_pass http://client;
}
location /sockjs-node {
proxy_pass http://client;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /api {
rewrite /api/(.*) /$1 break;
proxy_pass http://api;
}
}
Is there anything about this that AWS RDS or EB does not like?
nginx amazon-web-services docker elastic-beanstalk docker-compose
add a comment |
I have pushed all this code to my Github repo, TravisCI built a test image and tested my code, it passed the test. TravisCI then built production images, TravisCI pushed the production builds over to my Docker Hub and over to AWS Elasticbeanstalk, EB then presumably pulled the images from my Docker Hub and deployed it.
I am getting a 502 Bad Gateway on my application and I looked at the EB Logs and I believe this is the problem:
/var/log/containers/server-8b2907355681-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ error: password authentication failed for user "Postgres"
at Connection.parseE (/app/node_modules/pg/lib/connection.js:553:11)
at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:378:19)
at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:119:22)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 104,
severity: 'FATAL',
code: '28P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '328',
routine: 'auth_failed' }
However, I have corrected the password inside of EB Configuration to match exactly the one docker-compose.yml
file:
api:
build:
dockerfile: Dockerfile.dev
context: ./server
volumes:
- /app/node_modules
- ./server:/app
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- PGUSER=postgres
- PGHOST=postgres
- PGDATABASE=postgres
- PGPASSWORD=password_protected
- PGPORT=5432
I have tried changing Postgres
to postgres
inside the Elasticbeanstalk environment variables but that has not resolved the issue. I am still getting error: password authentication failed for user "Postgres"
I then deleted RDS instance and provisioned a new with the same exact username and password, case sensitive and all. I added that RDS to the Security Group, I am still getting a 502 Bad Gateway with the same error of:
/var/log/containers/server-8b2907355681-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ error: password authentication failed for user "Postgres"
at Connection.parseE (/app/node_modules/pg/lib/connection.js:553:11)
at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:378:19)
at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:119:22)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 104,
severity: 'FATAL',
code: '28P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '328',
routine: 'auth_failed' }
I provisioned a new PostgreSQL RDS for the third time, ensured that all username and passwords were the same including case sensitive and eliminated any special characters and this time not only did I still get the same error, I also got this one:
-------------------------------------
/var/log/containers/server-09be251b359b-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ Error: connect ETIMEDOUT 172.31.82.39:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: '172.31.82.39',
port: 5432 }
I don't have much else to go on except a 502 Bad Gateway is coming from Nginx and I am wondering if the issue lies in my Nginx configuration. Inside my Nginx service I have the default.conf
file:
upstream client {
server client:3000;
}
upstream api {
server api:5000;
}
server {
listen 80;
location / {
proxy_pass http://client;
}
location /sockjs-node {
proxy_pass http://client;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /api {
rewrite /api/(.*) /$1 break;
proxy_pass http://api;
}
}
Is there anything about this that AWS RDS or EB does not like?
nginx amazon-web-services docker elastic-beanstalk docker-compose
I have pushed all this code to my Github repo, TravisCI built a test image and tested my code, it passed the test. TravisCI then built production images, TravisCI pushed the production builds over to my Docker Hub and over to AWS Elasticbeanstalk, EB then presumably pulled the images from my Docker Hub and deployed it.
I am getting a 502 Bad Gateway on my application and I looked at the EB Logs and I believe this is the problem:
/var/log/containers/server-8b2907355681-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ error: password authentication failed for user "Postgres"
at Connection.parseE (/app/node_modules/pg/lib/connection.js:553:11)
at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:378:19)
at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:119:22)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 104,
severity: 'FATAL',
code: '28P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '328',
routine: 'auth_failed' }
However, I have corrected the password inside of EB Configuration to match exactly the one docker-compose.yml
file:
api:
build:
dockerfile: Dockerfile.dev
context: ./server
volumes:
- /app/node_modules
- ./server:/app
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- PGUSER=postgres
- PGHOST=postgres
- PGDATABASE=postgres
- PGPASSWORD=password_protected
- PGPORT=5432
I have tried changing Postgres
to postgres
inside the Elasticbeanstalk environment variables but that has not resolved the issue. I am still getting error: password authentication failed for user "Postgres"
I then deleted RDS instance and provisioned a new with the same exact username and password, case sensitive and all. I added that RDS to the Security Group, I am still getting a 502 Bad Gateway with the same error of:
/var/log/containers/server-8b2907355681-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ error: password authentication failed for user "Postgres"
at Connection.parseE (/app/node_modules/pg/lib/connection.js:553:11)
at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:378:19)
at Socket.<anonymous> (/app/node_modules/pg/lib/connection.js:119:22)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 104,
severity: 'FATAL',
code: '28P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '328',
routine: 'auth_failed' }
I provisioned a new PostgreSQL RDS for the third time, ensured that all username and passwords were the same including case sensitive and eliminated any special characters and this time not only did I still get the same error, I also got this one:
-------------------------------------
/var/log/containers/server-09be251b359b-stdouterr.log
-------------------------------------
> @ start /app
> node index.js
Listening
{ Error: connect ETIMEDOUT 172.31.82.39:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1097:14)
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: '172.31.82.39',
port: 5432 }
I don't have much else to go on except a 502 Bad Gateway is coming from Nginx and I am wondering if the issue lies in my Nginx configuration. Inside my Nginx service I have the default.conf
file:
upstream client {
server client:3000;
}
upstream api {
server api:5000;
}
server {
listen 80;
location / {
proxy_pass http://client;
}
location /sockjs-node {
proxy_pass http://client;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /api {
rewrite /api/(.*) /$1 break;
proxy_pass http://api;
}
}
Is there anything about this that AWS RDS or EB does not like?
nginx amazon-web-services docker elastic-beanstalk docker-compose
nginx amazon-web-services docker elastic-beanstalk docker-compose
asked 1 min ago
DanielDaniel
14311
14311
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "2"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f959231%2faws-elasticbeanstalk-docker-nginx-node-express-502-bad-gateway%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f959231%2faws-elasticbeanstalk-docker-nginx-node-express-502-bad-gateway%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown