Skip to content

Commit

Permalink
fix: auto encrypter client options
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Jan 29, 2025
1 parent 1e2a63a commit 9477255
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/client-side-encryption/auto_encrypter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ export class AutoEncrypter {
this._proxyOptions = options.proxyOptions || {};
this._tlsOptions = options.tlsOptions || {};
this._kmsProviders = options.kmsProviders || {};
this._awsCredentialProvider =
client.options.credentials?.mechanismProperties.AWS_CREDENTIAL_PROVIDER;

const mongoCryptOptions: MongoCryptOptions = {
cryptoCallbacks
Expand Down Expand Up @@ -331,6 +329,11 @@ export class AutoEncrypter {
* This function is a no-op when bypassSpawn is set or the crypt shared library is used.
*/
async init(): Promise<MongoClient | void> {
// This is handled during init() as the auto encrypter is instantiated during the client's
// parseOptions() call, so the client doesn't have its options set at that point.
this._awsCredentialProvider =
this._client.options.credentials?.mechanismProperties.AWS_CREDENTIAL_PROVIDER;

if (this._bypassMongocryptdAndCryptShared || this.cryptSharedLibVersionInfo) {
return;
}
Expand Down

0 comments on commit 9477255

Please sign in to comment.