Support Forums

Mongodb-client-encryption Not Found

I am working on a next app and when i try to deploy it on netlify it gives me ModuleNotFoundError: Module not found: Error: Can’t resolve ‘mongodb-client-encryption’ in ‘/opt/build/repo/node_modules/mongodb/lib’ this error. I’ve tried doing CI= yarn build in my build command but it didn’d work. Can anyone please help me!

Does this help:

Thanks @hrishikesh but I am not making netlify functions, I am using next’s api which are serverless and I haven’t included “mongodb-client-encryption” in my package.json so why i am getting this error ???

I tried to install “mongodb-client-encrpytion” but on the build time it gave me an error saying can’t found module “aws4”.

Quick update, I’ve found that “target: serverless” in my next.config.js is creating this issue. Can you help me with that ?

Hi @Billuboy

Have a look over Next.js on Netlify | Netlify Docs and see you have everything set up as per Netlify’s suggestions/requirements.