-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection failed: Failed to decode base64 #381
Comments
I'm getting this too periodically. I wonder if it's anything to do with this: 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: Obviously not a long term solution, but maybe it will work until the deno issue is resolved. |
The script below would reliably recreate the error at the time I was looking at this last year: import { MongoClient } from '../mod.ts';
for (let x = 0; x < 100000; x++) {
const client = new MongoClient();
const url = `mongodb://testadmin1:testpass1@localhost:27017?directConnection=true`
console.log('url:', url);
await client.connect(url);
await client.close()
console.log('');
} Running it now, on the latest main, I can no longer recreate the issue. I believe this is because we are no longer using |
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/[email protected]/src/client.ts:46:13)
my code looks like this:
export { MongoClient } from "https://deno.land/x/[email protected]/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
The text was updated successfully, but these errors were encountered: