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

BSON 4.4.1 has a bug where it refers to global in the browser, crashing it, 4.4.0 doesn't have that problem.

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • 5
    • Not Needed

      https://github.com/mongodb/js-bson/releases/tag/v4.4.1

      BSON operates differently on node, than it does in the browser. 4.4.1 breaks it's use in the browser node specific calls. 4.4.0 is fine so the problem is a new one.

      It makes a new call to global.performance which of course can not work, since the browser doesn't have global.

      It not only in the default, but is you specifically import the esm browser only version

      import BSON from 'bson/dist/bson.browser.esm';
      It is still there.
       
      Weirdly enough....  importing the umd version does not have it.
       
      Steps to reproduce: just import it, it will break before you even make a call. 
       
      I SUSPECT it is a side effect of https://jira.mongodb.org/browse/NODE-3376 since it has some changes in how the builds work. 

      Acceptance Criteria

      • Make bson.browser.esm.js work in the browser.
      • We should consider filing an additional ticket to create infrastructure for testing this work - implementing the infrastructure should not be handled as part of this ticket.

            Assignee:
            Unassigned Unassigned
            Reporter:
            blair.nilsson@gmail.com Blair Nilsson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: