Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5472

Module not found: Can't resolve 'dns

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 5.6.0, 5.7.0
    • Component/s: Core
    • Labels:
    • 2
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      What problem are you facing?

      When using NextJS 13 and the NodeJS driver for MongoDB, whenever I use:

      import {MongoClient} from "mongodb"

      I get an error:

      • error ./node_modules/mongodb/lib/cmap/auth/gssapi.js:4:0
        Module not found: Can't resolve 'dns'

      https://nextjs.org/docs/messages/module-not-found

      Import trace for requested module:
      ./node_modules/mongodb/lib/index.js

      What driver and relevant dependency versions are you using?

      I tried using both versions 5.6 and 5.7

      Steps to reproduce?

      Use the import statement where NextJS reads the file.

       

      Troubleshooting:

      I upgraded the driver from 5.6 to 5.7

      I deleted the node_modules and .next directories and rebuilt them

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            slaytons@slaytons.net Gabriel Slayton
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: