Bad auth : Authentication failed

Hi, I have problem with connection string. I use node and Mongoose. My connection string is:
const dbURI = ‘mongodb+srv://testUser:testPassword@test.mongodb.net/node-test?retryWrites=true&w=majority’

it is testign database - is empty. I get error message and I dont know, where is error

    { MongoError: bad auth : Authentication failed.
    at MessageStream.messageHandler (/home/azimut/work/node/mvc-t/node_modules/mongodb/lib/cmap/connection.js:268:20)
    at MessageStream.emit (events.js:198:13)
    at processIncomingData (/home/azimut/work/node/mvc-t/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
    at MessageStream._write (/home/azimut/work/node/mvc-t/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
    at doWrite (_stream_writable.js:415:12)
    at writeOrBuffer (_stream_writable.js:399:5)
    at MessageStream.Writable.write (_stream_writable.js:299:11)
    at TLSSocket.ondata (_stream_readable.js:710:20)
    at TLSSocket.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at TLSSocket.Readable.push (_stream_readable.js:224:10)
    at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) ok: 0, code: 8000, codeName: 'AtlasError', name: 'MongoError' }

Thank you

2 Likes

Please check your userid/password.Bad auth means wrong combination of userid/pwd
Can you connect by shell to your db?

1 Like

Thank you for your advice. I created new user account and now it is running.

2 Likes

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