-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Unknown
-
None
-
Affects Version/s: 6.8.0
-
Component/s: BSON
Use Case
Using bson module 6.8.0 inside a nextjs app (with app router) produces the following error:
```
Unhandled Runtime Error
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. Check the render method of `StaticGenerationSearchParamsBailoutProvider`.
```
Reproduce
- Use `npx create-next-app` with app router and typescript
- Install __ bson module `npm i bson`
- Create a source file test.ts where to import BSON and export a function that uses BSON.deserialize()
- Import that test.ts inside a React Component that uses the previously exported function that uses BSON.deserialize()
Something's wrong around module import/export somewhere. I'll try to publish a public github with this minimal reproduction scenario.
- related to
-
NODE-3376 Node.js BSON dist cannot serialize browser BSON dist ObjectId
- Closed
-
NODE-6321 Remove import of crypto from js-bson
- Backlog
-
NODE-4211 "bson" package: Browser shouldn't require("crypto")
- Closed
-
NODE-5773 Cant use BSON ObjectId in browser
- Closed
-
NODE-5816 NextJS 14 await is not defined
- Closed