mosh-hamedani / vidly-api-node

309 stars 282 forks source link

React Course: Vidly app Deployment in 2019 #20

Closed safi-alt closed 4 years ago

safi-alt commented 4 years ago

Screenshot (1) Screenshot (2)

I HAVE FOLLOWED EXACTLY STEP BY STEP OF WHAT MOSH TAUGHT BUT THE CONNECTION STRING FROM MONGODB ATLAS IS USED HERE INSTEAD OF THE MLAB WHICH MOSH TAUGHT BECAUSE THE MLAB IS BOUGHT BY MONGODB. I FOLLOWED THE MONGODB ATLAS GUIDE AND PICKED UP THE CONNECTION STRING FROM THE "CONNECT WITH MONGODB COMPASS" OPTION. I HAVE DONE EXACTLY WHAT MOSH TAUGHT BUT IT IS SHOWING THE ABOVEMENTIONED ERRORS. PLEASE HELP.

JonattanD1440 commented 4 years ago

After pushing your repository to Heroku try this command "heroku restart" to restart it and then "heroku open". hope this helps.

AgusDG commented 4 years ago

I was facing a similar issue. I solved it following the steps in this forum post.

https://forum.codewithmosh.com/d/694-may-2019-summary-of-react-tutorial-vidly-node-deployment-fixes

Hope it helps

andre-rd-rodrigues commented 3 years ago

I there! Just had this issue and saw that was asked many times all over the internet, so since I solved my problem, I thought it could be useful for those struggling.

Issue 1: mLab bought by MongoDB Atlas - config MongoDB Atlas

Issue 2: React Vidly App Deployment working on MongoDB Atlas but not connecting to Heroku

Solution Issue 1: Just install MongoDB Atlas and follow the steps (is pretty simple don't worry)

Issue 2: This way worked for me:

  1. Import genres (JSON object) for MongoDB Atlas Database - you can do it with MongoDB Compass, which facilitates the management of your MongoDB Database objects;
 Here's the link: https://www.mongodb.com/blog/post/import-export-your-data-with-compass

  2. Then, what happened to me was the connection to MongoDB Atlas was ok, but I didn't get any data from the database I had created. This problem is because the connection string was pointing to a database called test by default.
In your MongoDB Atlas go to: clusters > connect > connect your application > copy the connection string (something like this: mongodb+srv://:@.25vz6.mongodb.net/?retryWrites=true&w=majority) AND substitute with your user password and with the name of your database.
Here's the link: https://stackoverflow.com/questions/56397921/mongodb-atlas-connection-working-but-not-displaying-data-in-heroku

  3. Config Heroku in vidly-api-node (showed in video number 9 - Setting Environment Variables) - heroku config:set vidly_bd (...)


Now, this should be working :)

warebugg commented 2 years ago

it's a version issue [select version 2.2.12 or later] and it should work image ps: you can always edit your vidly_db variable in heroku dashboard easily