Implement the Serialization of a Passport User MONGO PARSE ERROR

Tell us what’s happening:
Hi,when i try to run the app in replit i get this error:

 npm start

fcc-advanced-node-and-express@0.0.1 start /home/runner/boilerplate-advancednode
node server.js

express-session deprecated req.secret; provide secret option server.js:22:9
Listening on port 3000
MongoParseError: URI malformed, cannot be parsed
at parseConnectionString (/home/runner/boilerplate-advancednode/node_modules/mongodb/lib/core/uri_parser.js:560:21)
at connect (/home/runner/boilerplate-advancednode/node_modules/mongodb/lib/operations/connect.js:282:3)
at /home/runner/boilerplate-advancednode/node_modules/mongodb/lib/mongo_client.js:223:5
at maybePromise (/home/runner/boilerplate-advancednode/node_modules/mongodb/lib/utils.js:662:3)
at MongoClient.connect (/home/runner/boilerplate-advancednode/node_modules/mongodb/lib/mongo_client.js:219:10)
at main (/home/runner/boilerplate-advancednode/connection.js:11:22)
at Object. (/home/runner/boilerplate-advancednode/server.js:32:1)
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)

this is my proect:
Your code so far

i cant find the error,i think i posted wrong the value of the MONGO URI, but i dont know how to fix it,any help?

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36.

Challenge: Implement the Serialization of a Passport User

Link to the challenge:

A couple of things need to be changed, and one of them is simple, and I can see why you missed it. You are going to want to replace your sample.env file with just .env instead, and your MONGO_URI is also incorrect as you are using the generic example they provided which will not help, but I’ll let you try to get the right URL on your own, but if you would like more help I’ll be glad to do so.

1 Like

Hello there,

As caryaharper mentioned, the issue is your MongoDB URI. There is a link in this lesson to a news article tutorial walking you through how to get a MongoDB Atlas URI, if you have not already done this section.:

Hope this helps

1 Like

thank you,i’ll look into it

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.