Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-5401

compass-aggregations importing v8 module when used in web browser

    • Iteration Seoul
    • Not Needed

      It looks like compass-aggregations imports the compass-logging package which imports mongodb-log-writer which currently assumes it’s being run in an electron environment. This ticket involves updating compass-logging to not import mongodb-log-writer when used in a browser environment.

      https://github.com/mongodb-js/compass/blob/main/packages/compass-aggregations/src/modules/create-view/index.js#L1
      We check if the environment is currently electron’s renderer, but not if it’s a web environment:
      https://github.com/mongodb-js/compass/blob/main/packages/compass-logging/src/index.ts#L30
      So we end up requiring mongodb-log-writer which has imports for file writing which would error on browser:
      https://github.com/mongodb-js/mongodb-log-writer/blob/main/src/index.ts#L8

      Once we've updated it to be used in the browser we should release so the dependency can be updated in cloud (mms).

      Down the line we might want to add a browser environment test for compass-aggregations and other shared compass packages to protect against regressions like this.

            Assignee:
            rhys.howell@mongodb.com Rhys Howell
            Reporter:
            rhys.howell@mongodb.com Rhys Howell
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: