File tree 1 file changed +5
-2
lines changed
src/client-side-encryption
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -239,8 +239,6 @@ export class AutoEncrypter {
239
239
this . _proxyOptions = options . proxyOptions || { } ;
240
240
this . _tlsOptions = options . tlsOptions || { } ;
241
241
this . _kmsProviders = options . kmsProviders || { } ;
242
- this . _awsCredentialProvider =
243
- client . options . credentials ?. mechanismProperties . AWS_CREDENTIAL_PROVIDER ;
244
242
245
243
const mongoCryptOptions : MongoCryptOptions = {
246
244
cryptoCallbacks
@@ -331,6 +329,11 @@ export class AutoEncrypter {
331
329
* This function is a no-op when bypassSpawn is set or the crypt shared library is used.
332
330
*/
333
331
async init ( ) : Promise < MongoClient | void > {
332
+ // This is handled during init() as the auto encrypter is instantiated during the client's
333
+ // parseOptions() call, so the client doesn't have its options set at that point.
334
+ this . _awsCredentialProvider =
335
+ this . _client . options . credentials ?. mechanismProperties . AWS_CREDENTIAL_PROVIDER ;
336
+
334
337
if ( this . _bypassMongocryptdAndCryptShared || this . cryptSharedLibVersionInfo ) {
335
338
return ;
336
339
}
You can’t perform that action at this time.
0 commit comments