question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NGINX 502 error with MongoDB and Mongo Express

See original GitHub issue

I created MongoDB and Mongo Express instances from the one click options. I thought it worked at first, but now I get the NGINX 502 error whenever I try to view a database.

Here is what I’ve done, checked or not done:

  1. Confirmed both apps are running. I am able to bring up the ME screen and see the three default databases. However, when I click on “view”, I get the 502 error.
  2. docker volume ls shows both persistent volumes.
  3. The log for Mongo shows, if I understand it, authentication against the admin database:
{"t":{"$date":"2021-01-16T01:00:51.147+00:00"},"s":"I",  "c":"NETWORK",  "id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"10.0.1.11:54460","connectionId":22,"connectionCount":3}}
{"t":{"$date":"2021-01-16T01:00:51.253+00:00"},"s":"I",  "c":"ACCESS",   "id":20250,   "ctx":"conn22","msg":"Successful authentication","attr":{"mechanism":"SCRAM-SHA-1","principalName":"root","authenticationDatabase":"admin","client":"10.0.1.11:54460"}}
{"t":{"$date":"2021-01-16T01:00:51.261+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn22","msg":"Connection ended","attr":{"remote":"10.0.1.11:54460","connectionId":22,"connectionCount":2}}
{"t":{"$date":"2021-01-16T01:00:51.262+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn20","msg":"Connection ended","attr":{"remote":"10.0.1.11:53852","connectionId":20,"connectionCount":1}}
{"t":{"$date":"2021-01-16T01:00:51.263+00:00"},"s":"I",  "c":"NETWORK",  "id":22944,   "ctx":"conn21","msg":"Connection ended","attr":{"remote":"10.0.1.11:53854","connectionId":21,"connectionCount":0}}
  1. The ME log shows connection:
Waiting for srv-captain--mongodb:27017...
Welcome to mongo-express
------------------------

Mongo Express server listening at http://0.0.0.0:8081
Server is open to allow connections from anyone (0.0.0.0)
Database connected
Admin Database connected
  1. Restarted the host VPS.
  2. I haven’t changed any of the App Config settings for either service except to add (as a troubleshooting step) HTTPS for ME. However, I am not forcing it.
  3. Read the docs on this issue
  4. Searched both caprover and this repo for matching issues or additional suggestions.
  5. ufw disable
  6. Created a new database (successfully) but still get the error if I try to view it. And I’m confused by the namespace???
{"t":{"$date":"2021-01-16T01:31:05.925+00:00"},"s":"I",  "c":"STORAGE",  "id":20320,   "ctx":"conn35","msg":"createCollection","attr":{"namespace":"Test.delete_me","uuidDisposition":"generated","uuid":{"uuid":{"$uuid":"54452b55-f01d-400a-8121-a681d28cb589"}},"options":{}}}
{"t":{"$date":"2021-01-16T01:31:05.932+00:00"},"s":"I",  "c":"INDEX",    "id":20345,   "ctx":"conn35","msg":"Index build: done building","attr":{"buildUUID":null,"namespace":"Test.delete_me","index":"_id_","commitTimestamp":{"$timestamp":{"t":0,"i":0}}}}

I apologize if I’ve missed something, but I would appreciate some additional steps I can take.

Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
tim-rohrercommented, Jan 16, 2021

Looks like it may have been fixed in mongo-express:0.54 image. Do this:

  • Go to Apps > Mongo Express
  • Go to Deployment tab
  • From “Method 6: Deploy via ImageName” deploy this image: mongo-express:0.54

Perfect. That works. Thank you.

Good catch on the ME bug. I didn’t even think that might be it since I wasn’t having troubles my own recently set up ME (within the past few days).

Have a good night, and I do appreciate your quick response.

1reaction
githubsaturncommented, Jan 16, 2021

Looks like it may have been fixed in mongo-express:0.54 image. Do this:

  • Go to Apps > Mongo Express
  • Go to Deployment tab
  • From “Method 6: Deploy via ImageName” deploy this image: mongo-express:0.54
Read more comments on GitHub >

github_iconTop Results From Across the Web

Intermittent 502 bad gateway error(using nginx,nodejs ...
The 502 bad gateway error means that nginx asked the nodejs server for some information, and the nodejs server answered and then "promptly...
Read more >
Nginx gives 502 Bad Gateway when proxying to nodejs app ...
I am trying to proxy the nginx to nodejs running on 4000, but it does not reach the backend. and the nginx gives...
Read more >
Node.js 502 Bad Gateway Issues and How To Resolve Them
In December of 2018, many Node.js users noticed that their applications randomly returned an HTTP status code 502 “Bad Gateway” error.
Read more >
[Solved]-Docker Compose with Angular, Express.js and Nginx
Coding example for the question Docker Compose with Angular, Express.js and Nginx - 502 response-mongodb.
Read more >
MEAN Stack with Pre-configured Mongo Express and Webmin ...
Intuz MEAN Stack is a pre-configured, ready to run image on Amazon EC2 and has Nginx, MongoDB, Mongo Express, NodeJS, ExpressJS, Webmin, AngularJS, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found