express-typescript
express-typescript copied to clipboard
UnhandledPromiseRejectionWarning: MongoError: (Unauthorized) not authorized on admin to execute command
Describe the bug The application throws a rejection which i believe has to do with the sessions package trying to make updates to mongodb on start. Full error log below
[WARN] UnhandledPromiseRejectionWarning: MongoError: (Unauthorized) not authorized on admin to execute command { insert: "system.indexes", documents: [[{ns admin.sessions} {key [{expires 1}]} {name expires_1} {expireAfterSeconds 0} {unique false}]], ordered: true }
at Function.MongoError.create (/Users/user/Documents/projects/express-typescript/node_modules/mongodb-core/lib/error.js:31:11)
at /Users/user/Documents/projects/express-typescript/node_modules/mongodb-core/lib/connection/pool.js:497:72
at authenticateStragglers (/Users/user/Documents/projects/express-typescript/node_modules/mongodb-core/lib/connection/pool.js:443:16)
at Connection.messageHandler (/Users/user/Documents/projects/express-typescript/node_modules/mongodb-core/lib/connection/pool.js:477:5)
at TLSSocket.<anonymous> (/Users/user/Documents/projects/express-typescript/node_modules/mongodb-core/lib/connection/connection.js:333:22)
at TLSSocket.emit (events.js:400:28)
at addChunk (internal/streams/readable.js:293:12)
at readableAddChunk (internal/streams/readable.js:267:9)
at TLSSocket.Readable.push (internal/streams/readable.js:206:10)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)
at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
at processPromiseRejections (internal/process/promises.js:247:11)
at processTicksAndRejections (internal/process/task_queues.js:96:32)
To Reproduce Steps to reproduce the behavior:
- run
yarn dev
ornpm run dev
Expected behavior App Should start
Screenshots N/A
Desktop (please complete the following information):
- OS: iOS 12.5
Smartphone (please complete the following information): N/A
Additional context Cannot use this template with session