Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(NODE-4254): allow csfle to be dynamically required #3260

Merged
merged 2 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1630,7 +1630,7 @@ tasks:
- func: bootstrap mongo-orchestration
vars:
VERSION: latest
TOPOLOGY: server
TOPOLOGY: replica_set
- func: bootstrap kms servers
- func: run custom csfle tests
- name: test-latest-server-noauth
Expand Down
2 changes: 1 addition & 1 deletion .evergreen/generate_evergreen_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ oneOffFuncAsTasks.push({
func: 'bootstrap mongo-orchestration',
vars: {
VERSION: 'latest',
TOPOLOGY: 'server'
TOPOLOGY: 'replica_set'
}
},
{ func: 'bootstrap kms servers' },
Expand Down
10 changes: 8 additions & 2 deletions src/encrypter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,15 @@ export class Encrypter {

static checkForMongoCrypt(): void {
let mongodbClientEncryption = undefined;
// Ensure you always wrap an optional require in the try block NODE-3199
try {
// Ensure you always wrap an optional require in the try block NODE-3199
mongodbClientEncryption = require('mongodb-client-encryption');
// Note (NODE-4254): This is to get around the circular dependency between
// mongodb-client-encryption and the driver in the test scenarios.
if (process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE) {
mongodbClientEncryption = require(process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE);
} else {
mongodbClientEncryption = require('mongodb-client-encryption');
}
} catch (err) {
throw new MongoMissingDependencyError(
'Auto-encryption requested, but the module is not installed. ' +
Expand Down