I tried to write the code by myself and clone if from your github , but it’s the same error everytime that i can’t get through.

Server 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.

This error happened while generating the page. Any console logs will be displayed in the terminal window.

.next\server\pages\index.js (18:19) @ Object.connect
16 | await mongoose.disconnect();
17 | }
> 18 | const db = await mongoose.connect(process.env.MONGODB_URI, {});
| ^
19 | console.log(‘new connection’);
20 | connection.isConnected = db.connections[0].readyState;
21 | }

Call Stack
async getServerSideProps
.next\server\pages\index.js (62:2)

The problem seems to be at the mongodb
because the project works fine till the moment the mongoose comes in.

I can’t get the part to add a product to the cart.

Thanks for your time!
I love your videos 😀

Basir Answered question October 11, 2022