I'm trying to deploy a MERN stack application on Heroku based on the mern.io boilerplate code, and to do so I was following this tutorial that is based on the same boilerplate code: https://github.com/jeffreynerona/mern-io-heroku.
I'm currently trying to link my MongoDB cluster to my application, so I used the exact URI generated by MongoDB and I ended with the following code:
const config = {
mongoURL: process.env.MONGO_URL || 'mongodb+srv://sam:sam1@cluster0-qnroe.mongodb.net/mern-starter',
port: process.env.PORT || 8000,
};
export default config;
However, this gave me the following error: Error: Invalid mongodb uri "mongodb+srv://sam:sam1@cluster0-qnroe.mongodb.net/mern-starter". Must begin with "mongodb://"
.
Just as reference, when I was hosting my application locally everything ran as it should. The rest of the code in the block above was the same, except the URI I had for that was mongodb://localhost:27017/mern-starter
. Any thoughts would be appreciated on why this new URI is giving me an error!