-
Type:
Bug
-
Resolution: Gone away
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.5.0
-
Component/s: Client Side Encryption
-
Environment:- Mongoose is not currently being used, however I would hope the fix to this issue can be applied to mongoose as well
My issue is when I try to connect to my Atlas database and have automatic encryption enabled, I get an error -
BSON field 'insert.jsonSchema' is an unknown field.
My script to reproduce is below. Mongocryptd should be running on Atlas's side and is not running on my pc.
const base64 = require('uuid-base64'); const { ClientEncryption } = require('mongodb-client-encryption'); const mongodb = require('mongodb'); const User = mongoose.model('users'); const { MongoClient, Binary } = mongodb; const { port, databaseUri, awsAccessID, awsAccessKey, awsRegion, cmkARN } = require('./env') run().catch(err => console.log(err)); async function run() { constkeyVaultNamespace = 'resellanalytics.encryption'; constkmsProviders = { aws: { accessKeyId:`${awsAccessID}`, secretAccessKey:`${awsAccessKey}`, } }; const client = await mongoose.connect(databaseUri, { useNewUrlParser:true, useUnifiedTopology:true, autoEncryption: { keyVaultNamespace, kmsProviders, extraOptions: { mongocryptdURI:databaseUri } } }); const encryption = new ClientEncryption(client.connection.client, { keyVaultNamespace, kmsProviders }); const key = await encryption.createDataKey('aws', { masterKey: { key:cmkARN, // e.g. 'arn:aws:kms:us-east-2:111122223333:alias/test-key' region:awsRegion, // e.g. 'us-east-1' } }); }