denodrivers / denodrivers/mongo

Bad auth

Open
#210 3 comments 1 reaction 0 assignees View on GitHub
atlas
Dominant language
TypeScript
Stars
511
Forks
89
PR merge metrics
No merged PRs in 30d

Description

After upgrading to latest version from v.0.13.0, I am no longer able to connect to the cluster.

```
error: Uncaught (in promise) Error: MongoError: "Connection failed: MongoError: {\"ok\":0,\"errmsg\":\"bad auth : Authentication failed.\",\"code\":8000,\"codeName\":\"AtlasError\"}"
throw new MongoError(`Connection failed: ${e.message || e}`);
```

I know the auth is correct because it works with compass from the same computer, and of course the same user/password worked just fine with the old version. Nothing has changed in atlas and my IP is whitelisted.

Code:
```ts
import { MongoClient } from 'https://deno.land/x/mongo@v0.23.1/mod.ts'

const dbuser = 'dbUser'
const dbpass = 'redacted'
const dbname = 'mydb'

const client = new MongoClient()
await client.connect({
db: dbname,
tls: true,
servers: [{
host: 'cluster0-shard-00-01.skgsx.mongodb.net',
port: 27017,
}],
credential: {
username: dbuser,
password: dbpass,
db: dbname,
mechanism: 'SCRAM-SHA-1',
},
})

const db = client.database(dbname)
```
I have also tried with: ```await client.connect(`mongodb+srv://${dbuser}:${dbpass}@cluster0.skgsx.mongodb.net/${dbname}?retryWrites=true&w=majority&authMechanism=SCRAM-SHA-1`)```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.