-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Closed
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.

Description
Run next info
(available from version 12.0.8 and up)
Binaries:
Node: 17.4.0
npm: 8.3.1
Yarn: 3.1.1
pnpm: N/A
Relevant packages:
next: 12.0.10
react: 18.0.0-rc.0
react-dom: 18.0.0-rc.0
What version of Next.js are you using?
12.0.10
What version of Node.js are you using?
17.4.0
What browser are you using?
Brave
What operating system are you using?
Windows
How are you deploying your application?
next dev
Describe the Bug
When i try to use mongoose
to connect to mongodb in server components it gives me an error:
TypeError: mongoose__WEBPACK_IMPORTED_MODULE_0___default(...).createConnection is not a function
Expected Behavior
It should not happen since it is inside server component, so it shouldn't import with webpack(web env), instead it should be import with default node env
To Reproduce
- create server component
- import mongoose inside it
- write code to connect mongodb with mongoose
- run nextjs
Metadata
Metadata
Assignees
Labels
bugIssue was opened via the bug report template.Issue was opened via the bug report template.