Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

bug: mongodb has to be a peer dependency #3

Open
plushdohn opened this issue Apr 25, 2023 · 1 comment
Open

bug: mongodb has to be a peer dependency #3

plushdohn opened this issue Apr 25, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@plushdohn
Copy link
Collaborator

plushdohn commented Apr 25, 2023

The mongodb package is leaving some disgusting warning logs whenever it's first loaded inside the app that uses Catalyst:

Screenshot 2023-04-26 at 21 33 32

This has only started happening since Catalyst was moved to a separate package. When the source files were part of the Next project, no such logs were visible.

I have no idea what is causing this, I thought it might have to do with mongodb being wrongfully imported in the browser but I don't see where or how this is happening.

@plushdohn plushdohn added the bug Something isn't working label Apr 25, 2023
@plushdohn
Copy link
Collaborator Author

Ok so I found out two things:

  • Someone opened an issue on the Next repo for the exact same reason, but they were using Mongoose.
  • This doesn't happen if MongoDB is a direct dependency of the Next.js app that's running Catalyst.

This means that this error only occurs when MongoDB is used internally by a package that's then imported in the Next app (as is the case with Mongoose or Catalyst), and that we can temporarily fix it by making mongodb a peer dependency in our core package.

This is far from ideal as we don't really want the user to care about having mongodb in their dependencies, but for now it allows us to develop comfortably, and some package managers at least auto-install peer dependencies so it's not that bad.

@plushdohn plushdohn changed the title bug: mongodb warn logs in development bug: mongodb has to be a peer dependency May 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant