We help IT Professionals succeed at work.
Get Started

UnhandledPromiseRejectionWarning: MongoError: not authorized on test to execute command...What the smoke?

Bruce Gust
Bruce Gust asked
on
323 Views
Last Modified: 2020-01-14
We've been asked to download a project and be ready to comment intelligently in a meeting tomorrow, so I'm trying to get this app up and running on my local box, but I'm running into errors that I've not encountered before.

Here is the error as it appears on my terminal:

Listening on PORT: 3000
(node:3316) UnhandledPromiseRejectionWarning: MongoError: not authorized on test to execute command { insert: "system.indexes", documents: [ { ns: "test.user_sess
ions", key: { expires: 1 }, name: "expires_1", expireAfterSeconds: 0, unique: false } ], ordered: true, writeConcern: { w: "majority" }, lsid: { id: UUID("9674b2b
b-4da6-401a-9d90-7b0f35ace911") }, readConcern: { afterClusterTime: Timestamp(1579010568, 1) }, $clusterTime: { clusterTime: Timestamp(1579010568, 1), signature:
{ hash: BinData(0, 2F281F7B9881E802501648F77CC4113E4B119167), keyId: 6749132984986632193 } }, $db: "test" }
    at Connection.<anonymous> (C:\wamp64\www\bsmart\PRAMS\node_modules\mongoose\node_modules\mongodb-core\lib\connection\pool.js:443:61)
    at Connection.emit (events.js:210:5)
    at processMessage (C:\wamp64\www\bsmart\PRAMS\node_modules\mongoose\node_modules\mongodb-core\lib\connection\connection.js:364:10)
    at TLSSocket.<anonymous> (C:\wamp64\www\bsmart\PRAMS\node_modules\mongoose\node_modules\mongodb-core\lib\connection\connection.js:533:15)
    at TLSSocket.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at TLSSocket.Readable.push (_stream_readable.js:224:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:182:23)
(node:3316) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch bl
ock, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3316) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the N
ode.js process with a non-zero exit code.

Open in new window


Here's the error as it appears on my web browser:

Error: secret option required for sessions
    at session (C:\wamp64\www\bsmart\PRAMS\node_modules\express-session\index.js:200:12)
    at Layer.handle [as handle_request] (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:317:13)
    at C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:284:7
    at Function.process_params (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:335:12)
    at next (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:275:10)
    at expressInit (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\middleware\init.js:40:5)
    at Layer.handle [as handle_request] (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:317:13)
    at C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:284:7
    at Function.process_params (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:335:12)
    at next (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:275:10)
    at query (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\middleware\query.js:45:5)
    at Layer.handle [as handle_request] (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:317:13)
    at C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:284:7
    at Function.process_params (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:335:12)
    at next (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:275:10)
    at Function.handle (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\router\index.js:174:3)
    at Function.handle (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\application.js:174:10)
    at Server.app (C:\wamp64\www\bsmart\PRAMS\node_modules\express\lib\express.js:39:9)
    at Server.<anonymous> (C:\wamp64\www\bsmart\PRAMS\node_modules\engine.io\lib\server.js:470:22)

Open in new window


What does all of this mean and how can I fix it?

Thanks!
Comment
Watch Question
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE