File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/client-side-encryption Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -239,8 +239,6 @@ export class AutoEncrypter {
239239 this . _proxyOptions = options . proxyOptions || { } ;
240240 this . _tlsOptions = options . tlsOptions || { } ;
241241 this . _kmsProviders = options . kmsProviders || { } ;
242- this . _awsCredentialProvider =
243- client . options . credentials ?. mechanismProperties . AWS_CREDENTIAL_PROVIDER ;
244242
245243 const mongoCryptOptions : MongoCryptOptions = {
246244 cryptoCallbacks
@@ -331,6 +329,11 @@ export class AutoEncrypter {
331329 * This function is a no-op when bypassSpawn is set or the crypt shared library is used.
332330 */
333331 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+
334337 if ( this . _bypassMongocryptdAndCryptShared || this . cryptSharedLibVersionInfo ) {
335338 return ;
336339 }
You can’t perform that action at this time.
0 commit comments