React Vidly App Deployment issue SOLVED

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)

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 :slight_smile:

1 Like