QA Advanced Node & Express - Database connection

Tell us what’s happening:
I have trouble trying to pass, Implement the Serialization of a Passport User .
I need help to pass the Database connection should be present.

Error:
express-session deprecated req.secret; provide secret option server.js:21:9
Listening on port undefined
MongoParseError: URI malformed, cannot be parsed
at parseConnectionString (/home/runner/boilerplate-advancednode-1/node_modules/mongodb/lib/core/uri_parser.js:580:21)
at connect (/home/runner/boilerplate-advancednode-1/node_modules/mongodb/lib/operations/connect.js:283:3)
at /home/runner/boilerplate-advancednode-1/node_modules/mongodb/lib/mongo_client.js:284:5
at maybePromise (/home/runner/boilerplate-advancednode-1/node_modules/mongodb/lib/utils.js:692:3)
at MongoClient.connect (/home/runner/boilerplate-advancednode-1/node_modules/mongodb/lib/mongo_client.js:280:10)
at main (/home/runner/boilerplate-advancednode-1/connection.js:11:22)
at Object. (/home/runner/boilerplate-advancednode-1/server.js:31:1)

Your project link(s)
My project

Your browser information:

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

Challenge: Implement the Serialization of a Passport User

Link to the challenge:

Yes

My sample.env have:

PORT=8080
NODE_ENV=development
MONGO_URI=mongodb+srv://matostest:password@cluster0.gj2up1e.mongodb.net/myFirstDatabase?retryWrites=true&w=majority
SESSION_SECRET=‘whateverSomeString’

Thank you mate !! thatsworks but now i have a new problem

MongoServerSelectionError: connection to 54.94.172.167:27017 closed
at Timeout._onTimeout (/home/runner/boilerplate-advancednode-1/node_modules/mongodb/lib/core/sdam/topology.js:438:30)

Did you whitelist your current IP address? It may be easier to just whitelist 0.0.0.0/0

1 Like

TY !! problem fixed :slight_smile:

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