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

Validate modules can be missing and a MongoClient can still run operations

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Testing
    • Labels:

      How are you using Mongo? What version of the server and driver are you using?

      Using the driver in a custom JS runtime

      What is the feature/improvement you would like?

      I want to add a test that proves the driver operates when these modules resolve to undefined.

           kerberos: false,
           '@mongodb-js/zstd': false,
           '@aws-sdk/credential-providers': false,
           snappy: false,
           'mongodb-client-encryption': false,
           socks: false,
           aws4: false,
           dns: false,
           http: false,
           saslprep: false,
           'fs/promises': false,
           zlib: false,
           fs: false,
           path: false,
      
          // special case
          tls: false,
      

      What use case would this feature/improvement enable?

      This minimizes the surface area of the API needed to get a working driver without TLS and many other features the above modules provide.

      Implementation ideas:

      We have the logic in test/mongodb.ts that loads the legacy driver in a way that replaces the global require in a new vm context so we can customize where the 'mongodb' import come from. We can reuse this to provide a require that will return undefined for the above modules and use the returned client to run a few CRUD operations.

      TBD on how much the driver should be able to do:

      • auth? - Is saslprep required?
      • tls? - Any prod env should have tls enabled, can all tls options be provided without 'fs'

            Assignee:
            Unassigned Unassigned
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: