Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKevin Becerra
14,243 PointsCannot convert undefined or null to object
I'm trying to find out what exactly is causing the app to return me that error. The most I know is that it has something to do with the modules. When I have the most up-to-date ones I get that error but when I revert to the ones at the time of the lesson the app works. I just want to know what exactly was deprecated or changed in order to have the app working with the most recent modules.
Thanks in advance!
1 Answer
Ismat Valiyev
Front End Web Development Techdegree Graduate 33,874 PointsThe problem is with "connect-mongo": ยซ^2.0.1ยป, https://github.com/jdesboeufs/connect-mongo/issues/277
Nathan Boaldin
Courses Plus Student 12,545 PointsJust confirming that this fixes the problem. Change this code in your session middleware:
store: new MongoStore({ mongooseConnection: db })
to:
store: new MongoStore({ url: config.MONGODB_URI })
Where the code says "config.MONGODB_URI" place the actual url to your mongodb database.
Kevin Becerra
14,243 PointsKevin Becerra
14,243 PointsThese are the project files so you can see the code.
https://treehouse-code-samples.s3.amazonaws.com/JavaScript-user-auth-express.zip