I am trying to deploy an AdonisJS app on Elastic Beanstalk. I have followed several tutorials to do so but I am getting 502 Bad Gateway :(
I have set PORT
env variable to 8081 from the Configuration portal as suggested in all the tutorials out there.
----------------------------------------
/var/log/nginx/error.log
----------------------------------------
2020/12/28 19:54:52 [error] 5218#0: *266 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.xxx.xx, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8081/", host: "172.xx.xx.x"
----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Dec 28 20:06:36 ip-xxx-31-30-5 web: > adonis-api-app@4.1.0 start /var/app/current
Dec 28 20:06:36 ip-xxx-31-30-5 web: > node server.js
Dec 28 20:06:37 ip-xxx-31-30-5 web: #033[32minfo#033[39m: serving app on http://xxxxx-api-staging.us-west-2.elasticbeanstalk.com:8081
Dec 28 20:06:37 ip-xxx-31-30-5 web: events.js:291
Dec 28 20:06:37 ip-xxx-31-30-5 web: throw er; // Unhandled 'error' event
Dec 28 20:06:37 ip-xxx-31-30-5 web: ^
Dec 28 20:06:37 ip-xxx-31-30-5 web: Error: listen EADDRNOTAVAIL: address not available 44.242.xx.xx:8081
Dec 28 20:06:37 ip-xxx-31-30-5 web: at Server.setupListenHandle [as _listen2] (net.js:1300:21)
Dec 28 20:06:37 ip-xxx-31-30-5 web: at listenInCluster (net.js:1365:12)
Dec 28 20:06:37 ip-xxx-31-30-5 web: at GetAddrInfoReqWrap.doListen [as callback] (net.js:1502:7)
Dec 28 20:06:37 ip-xxx-31-30-5 web: at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:68:8)
Dec 28 20:06:37 ip-xxx-31-30-5 web: Emitted 'error' event on Server instance at:
Dec 28 20:06:37 ip-xxx-31-30-5 web: at emitErrorNT (net.js:1344:8)
Dec 28 20:06:37 ip-xxx-31-30-5 web: at processTicksAndRejections (internal/process/task_queues.js:84:21) {
Dec 28 20:06:37 ip-xxx-31-30-5 web: code: 'EADDRNOTAVAIL',
Dec 28 20:06:37 ip-xxx-31-30-5 web: errno: 'EADDRNOTAVAIL',
Dec 28 20:06:37 ip-xxx-31-30-5 web: syscall: 'listen',
Dec 28 20:06:37 ip-xxx-31-30-5 web: address: '44.242.xx.xx',
Dec 28 20:06:37 ip-xxx-31-30-5 web: port: 8081
Dec 28 20:06:37 ip-xxx-31-30-5 web: }
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! code ELIFECYCLE
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! errno 1
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! adonis-api-app@4.1.0 start: `node server.js`
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! Exit status 1
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR!
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! Failed at the adonis-api-app@4.1.0 start script.
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! A complete log of this run can be found in:
Dec 28 20:06:37 ip-xxx-31-30-5 web: npm ERR! /home/webapp/.npm/_logs/2020-12-28T20_06_37_082Z-debug.log
Please help as its getting really frustrating now :(
Thank you