I am trying to create a mongo connection with auto encryption enabled inside the AWS-lambda function. I have also given the mongocryptd spawn path, but the connection failed with the following error
Is there any error in my code? for locally it’s working fine
const tmpPath = path.resolve(process.env.LAMBDA_TASK_ROOT, "../../tmp");
process.env.LD_LIBRARY_PATH = `${process.env.LD_LIBRARY_PATH}:${process.env.LAMBDA_TASK_ROOT}/lib`;
this.secureClient = new MongoClient({atlas_cluster_URI}, {
useNewUrlParser: true,
useUnifiedTopology: true,
autoEncryption: {
keyVaultNamespace,
kmsProviders,
schemaMap: accountsSchema,
extraOptions: {
mongocryptdBypassSpawn: true,
mongocryptdSpawnArgs: [`--pidfilepath=${tmpPath}/mongocryptd.pid`],
mongocryptdSpawnPath: `${process.env.LAMBDA_TASK_ROOT}/bin/mongocryptd`,
}
},
});
await this.secureClient.connect();