Open demienYu opened 2 years ago
I'm getting this too periodically. I wonder if it's anything to do with this: https://github.com/denoland/deno/issues/19546
The full error I get is:
error: InvalidCharacterError: Failed to decode base64
const binString = atob(b64);
^
at atob (ext:deno_web/05_base64.js:28:16)
at Module.decode (https://deno.land/std@0.202.0/encoding/base64.ts:138:21)
at continueScramConversation (file:///testproject/mongo/src/auth/scram.ts:196:11)
at eventLoopTick (ext:core/01_core.js:178:11)
at async Cluster.authenticateToServer (file:///testproject/mongo/src/cluster.ts:86:7)
at async Promise.all (index 0)
at async Cluster.authenticate (file:///testproject/mongo/src/cluster.ts:55:23)
at async MongoClient.connect (file:///testproject/mongo/src/client.ts:37:7)
at async createDatabase (file:///testproject/lib/utils/createDatabase.ts:25:3)
I've tried using a custom base64 locally and it seems to have solved the issues for me: https://github.com/denodrivers/mongo/pull/406
Obviously not a long term solution, but maybe it will work until the deno issue is resolved.
From time 2 time i see this error. Call stack: Error: MongoError: "Connection failed: Failed to decode base64." at MongoClient.connect (https://deno.land/x/mongo@v0.31.1/src/client.ts:46:13)
my code looks like this:
export { MongoClient } from "https://deno.land/x/mongo@v0.31.1/mod.ts" const client = new MongoClient() const options = { servers: [{host: MONGO_HOST, port: MONGO_PORT}], credential: {username: MONGO_USER, password: MONGO_PWD, db: 'admin', mechanism: 'SCRAM-SHA-1'}, db: 'mydb' } await client.connect(options) // this line causes error