0

The code runs without error when the server is local, but when i try to connect to mongodb-atlas it shows an error.

//mongoose.connect("mongodb+srv://namdi:@yelpcamp-wd2aa.mongodb.net/test?retryWrites=true&w=majority", { useNewUrlParser: true });

2019-06-20T10:55:44.983125+00:00 heroku[web.1]: Starting process with command npm start

2019-06-20T10:55:47.498330+00:00 app[web.1]:

2019-06-20T10:55:47.498348+00:00 app[web.1]: > v1@1.0.0 start /app

2019-06-20T10:55:47.498350+00:00 app[web.1]: > node app.js

2019-06-20T10:55:47.498352+00:00 app[web.1]:

2019-06-20T10:55:48.078344+00:00 app[web.1]: Warning: connect.session() MemoryStore is not

2019-06-20T10:55:48.078381+00:00 app[web.1]: designed for a production environment, as it will leak

2019-06-20T10:55:48.078384+00:00 app[web.1]: memory, and will not scale past a single process.

2019-06-20T10:55:48.090007+00:00 app[web.1]: YelpCamp don start

2019-06-20T10:55:48.219655+00:00 app[web.1]: (node:23)

UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [yelpcamp-shard-00-00-wd2aa.mongodb.net:27017] on first connect [MongoNetworkError: connection 5 to yelpcamp-shard-00-00-wd2aa.mongodb.net:27017 closed]

Dominic
  • 62,658
  • 20
  • 139
  • 163
nnamdi
  • 131
  • 1
  • 6

0 Answers0