Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS 13 MongoDB Module not found: Can't resolve ******** #42137

Closed
1 task done
armandodlvr opened this issue Oct 29, 2022 · 3 comments
Closed
1 task done

NextJS 13 MongoDB Module not found: Can't resolve ******** #42137

armandodlvr opened this issue Oct 29, 2022 · 3 comments
Labels
bug Issue was opened via the bug report template.

Comments

@armandodlvr
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:54 PDT 2022; root:xnu-8792.41.9~2/RELEASE_X86_64
Binaries:
  Node: 16.14.0
  npm: 8.5.0
  Yarn: N/A
  pnpm: N/A
Relevant packages:
  next: 13.0.0
  eslint-config-next: 13.0.0
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

Chrome 106.0.5249.119

How are you deploying your application? (if relevant)

Vercel

Describe the Bug

When I try to connect to MongoDB using a server component (layout.tsx for example) I get:

Module not found: Can't resolve 'mongodb-client-encryption' in '/Users/armandodelavegaruiz/new-nuberti/app-client/node_modules/mongodb/lib'

Module not found: Can't resolve 'aws-crt' in '/Users/armandodelavegaruiz/new-nuberti/app-client/node_modules/@aws-sdk/util-user-agent-node/dist-cjs'

./node_modules/mongodb/lib/bson.js
Module not found: Can't resolve 'bson-ext' in '/Users/armandodelavegaruiz/new-nuberti/app-client/node_modules/mongodb/lib'

./node_modules/mongodb/lib/deps.js
Module not found: Can't resolve 'kerberos' in '/Users/armandodelavegaruiz/new-nuberti/app-client/node_modules/mongodb/lib'

If I do the same thing using page/api/endpoint.ts it works fine.

Expected Behavior

Being able to consume MongoDB while using a server component.

Link to reproduction

https://codesandbox.io/s/intelligent-maria-e4m9v0?file=/app/layout.tsx

To Reproduce

Add MongoDB to a server component.

@armandodlvr armandodlvr added the bug Issue was opened via the bug report template. label Oct 29, 2022
@alextarana
Copy link

Facing the same issue, any update?

@ijjk
Copy link
Member

ijjk commented Nov 2, 2022

Closing as duplicate of #42277

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants