Skip to content

Commit

Permalink
chore: expand comment
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed Jul 18, 2022
1 parent 438430b commit 8f82a0f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1426,14 +1426,18 @@ export function getMongoDBClientEncryption(): {
process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE.length > 0
) {
try {
// NOTE(NODE-3199): Ensure you always wrap an optional require in the try block
// NOTE(NODE-3199): Ensure you always wrap an optional require literally in the try block
// Cannot be moved to helper utility function, bundlers search and replace the actual require call
// in a way that makes this line throw at bundle time, not runtime, catching here will make bundling succeed
mongodbClientEncryption = require(process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE);
} catch {
// ignore
}
} else {
try {
// NOTE(NODE-3199): Ensure you always wrap an optional require in the try block
// NOTE(NODE-3199): Ensure you always wrap an optional require literally in the try block
// Cannot be moved to helper utility function, bundlers search and replace the actual require call
// in a way that makes this line throw at bundle time, not runtime, catching here will make bundling succeed
mongodbClientEncryption = require('mongodb-client-encryption');
} catch {
// ignore
Expand Down

0 comments on commit 8f82a0f

Please sign in to comment.