I am getting a application error screen, when I check the heroku logs for my app I get this error : MongooseError: The uri parameter to openUri() must be a string, got "undefined". Make sure the first parameter to mongoose.connect() or mongoose.createConnection() is a string.
in my App.js : require('./config/database'); my database.js
const mongoose = require('mongoose');
const db = mongoose.connection;
mongoose.connect(process.env.DATABASE_URI, {
useNewUrlParser: true,
});
db.on('connected', () => {
console.log(`Connected to MongoDB on ${db.host}:${db.port}`);
});
in my .env files(changed credentials) : DATABASE_URI="mongodb+srv://admin:abc@cluster0.9vfr4.mongodb.net/statezz?retryWrites=true&w=majority"
Appreciate your help figuring out why is this happening ? the local version works just fine on my machine, and deployment was smooth but I am just getting the application error screen with no codes even!
thanks in advance.