Skip to content

UnhandledPromiseRejectionWarning: MongoError: (Unauthorized) not authorized on admin to execute command #21

@CeoFred

Description

@CeoFred

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:

  1. run yarn dev or npm 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions