Skip to content

Commit 8f82a0f

Browse files
committed
chore: expand comment
1 parent 438430b commit 8f82a0f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,14 +1426,18 @@ export function getMongoDBClientEncryption(): {
14261426
process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE.length > 0
14271427
) {
14281428
try {
1429-
// NOTE(NODE-3199): Ensure you always wrap an optional require in the try block
1429+
// NOTE(NODE-3199): Ensure you always wrap an optional require literally in the try block
1430+
// Cannot be moved to helper utility function, bundlers search and replace the actual require call
1431+
// in a way that makes this line throw at bundle time, not runtime, catching here will make bundling succeed
14301432
mongodbClientEncryption = require(process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE);
14311433
} catch {
14321434
// ignore
14331435
}
14341436
} else {
14351437
try {
1436-
// NOTE(NODE-3199): Ensure you always wrap an optional require in the try block
1438+
// NOTE(NODE-3199): Ensure you always wrap an optional require literally in the try block
1439+
// Cannot be moved to helper utility function, bundlers search and replace the actual require call
1440+
// in a way that makes this line throw at bundle time, not runtime, catching here will make bundling succeed
14371441
mongodbClientEncryption = require('mongodb-client-encryption');
14381442
} catch {
14391443
// ignore

0 commit comments

Comments
 (0)