When I import server component using mongodb atlas on react, dependencies cant be resolved

In react (next JS) I can import and use mongodb fine in a server component. However, when I try to import the server component into a client component I get the following error:

Module not found: Can't resolve 'mongodb-client-encryption' in 'C:\...'

Import trace for requested module:
./node_modules/mongodb/lib/deps.js
./node_modules/mongodb/lib/client-side-encryption/client_encryption.js
./node_modules/mongodb/lib/index.js
./app/lib/mongodb.js
./app/components/ig-report/reportOverviewTable.js
./app/reportdisplay/page.js

This is occurring for the following dependencies:

mongodb-client-encryption
aws4
socks
snappy
gcp-metadata
aws-sdk
zstd
kerberos

Hey @Rupey_N_A,

I believe this issue is related to a specific GitHub issue #42277. Based on the shared workaround, I recommend testing v13.0.2-canary.0 of Next.js. Please give it a try!

In case the issue persists, I’d recommend opening a GitHub issue here.

Regards,
Kushagra