Skip to content

Commit 3ce148d

Browse files
authored
fix(NODE-3397): report more helpful error with unsupported authMechanism in initial handshake (#2876)
1 parent 558182f commit 3ce148d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/core/connection/connect.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ function prepareHandshakeDocument(authContext, callback) {
179179
}
180180

181181
const authProvider = AUTH_PROVIDERS[credentials.mechanism];
182+
if (authProvider == null) {
183+
return callback(new MongoError(`No AuthProvider for ${credentials.mechanism} defined.`));
184+
}
182185
authProvider.prepare(handshakeDoc, authContext, callback);
183186
return;
184187
}

0 commit comments

Comments
 (0)