Hey Guys,
from one day to another my .env File seems to have an issue…
I have published the exact same code on vercel and defined the same Environment Variables and it works without a problem.
The message i am getting:
MongoParseError: Invalid scheme, expected connection string to start with “mongodb://” or “mongodb+srv://”
thanks for your reply. I have seen this aswell. However its not necessary… since my Live-Page with the same Code is working right now.
…Even weirder: Yesterday it suddenly worked… now it doesnt work anymore (talking about npm run dev only…)
my live page is living happily ever after…
I followed the following tutorial to set it up: youtube-Tutorial
Do you maybe have another idea what the reason might be ?
EDIT:
I now found out that when i paste my MONGODB_URI string directly into my db.js file… so it says:
const db = await mongoose.connect('mongodb+srv://XXX:XXXX@cluster0.tvglm.mongodb.net/XXXX?retryWrites=true&w=majority');
then it works fine… so maybe i need to find a different workaround to get the string correctly?..
I cant get the “dotenv” module to work … can you give me another hint where i would add the “require…” ?
… When i console.log(process.env.MONGODB_URI) just before the original line; i am getting my MONGODB_URI Link as a string: “…”
i dont understand why it cant use it in the next line right after it