Skip to content

Commit cd6b5a0

Browse files
authored
fix(NODE-4254): allow csfle to be dynamically required (#3260)
1 parent 4b9ad77 commit cd6b5a0

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.evergreen/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ tasks:
16301630
- func: bootstrap mongo-orchestration
16311631
vars:
16321632
VERSION: latest
1633-
TOPOLOGY: server
1633+
TOPOLOGY: replica_set
16341634
- func: bootstrap kms servers
16351635
- func: run custom csfle tests
16361636
- name: test-latest-server-noauth

.evergreen/generate_evergreen_tasks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ oneOffFuncAsTasks.push({
512512
func: 'bootstrap mongo-orchestration',
513513
vars: {
514514
VERSION: 'latest',
515-
TOPOLOGY: 'server'
515+
TOPOLOGY: 'replica_set'
516516
}
517517
},
518518
{ func: 'bootstrap kms servers' },

src/encrypter.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,15 @@ export class Encrypter {
124124

125125
static checkForMongoCrypt(): void {
126126
let mongodbClientEncryption = undefined;
127+
// Ensure you always wrap an optional require in the try block NODE-3199
127128
try {
128-
// Ensure you always wrap an optional require in the try block NODE-3199
129-
mongodbClientEncryption = require('mongodb-client-encryption');
129+
// Note (NODE-4254): This is to get around the circular dependency between
130+
// mongodb-client-encryption and the driver in the test scenarios.
131+
if (process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE) {
132+
mongodbClientEncryption = require(process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE);
133+
} else {
134+
mongodbClientEncryption = require('mongodb-client-encryption');
135+
}
130136
} catch (err) {
131137
throw new MongoMissingDependencyError(
132138
'Auto-encryption requested, but the module is not installed. ' +

0 commit comments

Comments
 (0)