Skip to content

Commit

Permalink
fix(service-provider-server): pass in driver to fle addon directly CO…
Browse files Browse the repository at this point in the history
…MPASS-6342 (#1368)

See the ticket/source comments for details. I’ve confirmed that this
fixes the bug, although the main thing to address here is probably
writing an e2e test in Compass.
  • Loading branch information
addaleax authored Dec 2, 2022
1 parent 73306bb commit 0f7d57a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/service-provider-server/src/cli-service-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,13 @@ class CliServiceProvider extends ServiceProviderCore implements ServiceProvider
this.baseCmdOptions = { ... DEFAULT_BASE_OPTIONS }; // currently do not have any user-specified connection-wide command options, but I imagine we will eventually
this.dbcache = new WeakMap();
try {
this.fle = require('mongodb-client-encryption');
// The .extension() call may seem unnecessary, since that is the default
// for the top-level exports from mongodb-client-encryption anyway.
// However, for the browser runtime, we externalize mongodb-client-encryption
// since it is a native addon package; that means that if 'mongodb' is
// included in the bundle, it won't be able to find it, and instead needs
// to receive it as an explicitly passed dependency.
this.fle = require('mongodb-client-encryption').extension(require('mongodb'));
} catch { /* not empty */ }
}

Expand Down

0 comments on commit 0f7d57a

Please sign in to comment.