Tell us what’s happening:
Describe your issue in detail here.

Since you cannot use a .env file I have included it on as a Secret (asterisks indicate my user, password, and db) as follows:

I have no spaces, have tried all solutions on forum from searches
I installed mongodb and mongoose via npm, and obviously required mongoose and set it to the variable mongoose

Nothing has worked…

Here’s the error I’m getting via console:

> fcc-mongo-mongoose-challenges@0.0.1 start /home/runner/boilerplate-mongomongoose
> node server.js

Your app is listening on port 3000
(node:77) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of null
    at parseSrvConnectionString (/home/runner/boilerplate-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/core/uri_parser.js:50:23)

Your code so far

Secret Key:
Secret Value:
const mongoose = require('mongoose');
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0

Challenge: Install and Set Up Mongoose

Link to the challenge:

Hello there,

Do you include the = (equals) sign in the property name? If so, remove it.

are the quotes included? because written like that it make them part of the value, you should not write extra characters other than the actual value

single quotes are included as instructed… will try without

I removed single quotes…

Your app is listening on port 3000
(node:218) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(node:218) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [] on first connect [MongoError: bad auth : Authentication failed.

I fixed { useUnifiedTopology: true }

our app is listening on port 3000
(node:403) UnhandledPromiseRejectionWarning: MongoError: bad auth : Authentication failed.
at MessageStream.messageHandler (/home/runner/boilerplate-mongomongoose/node_modules/mongoose/node_modules/mongodb/lib/cmap/connection.js:272:20)

generated password, now working :slight_smile: Thank you all :smile:

where is this instructed? you never put values in quotes in an .env file

Sorry, my mistake

It’s listed under hints and solution1


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