ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • bson-7.3.4
    • Affects Version/s: 7.3.0
    • Component/s: BSON
    • 2
    • 3
    • Not Needed
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None


      Expected Behavior

      As a js-bson user
      I expect ObjectID static initializers not to throw
      When importing packages in the NextJS Edge Runtime

      Actual Behavior and Impact

      • When importing js-bson in the NextJS Edge runtime, the static initializer will cause a throw
      • # of impacted users grows as more users adopt the latest version of js-bson, as this was introduced in a recent release

      Dependencies

      • N/A

      Risks/Unknowns

      • N/A

      Acceptance Criteria

      Implementation Requirements

      • The throw site is getBuiltinModule() in ObjectId's static initializer, which is an optional API and should not throw. The NextJS Edge runtime has misimplemented this api with a stub, which causes the throw. There's no guarantee that we'll have https://github.com/vercel/next.js/issues/98226 resolved quickly, and in the interim, we're broken on this one popular runtime. Adding a try-catch around getBuiltinModule is a safe way to prevent impeding our users, and this try-catch should have a callout to the issue in question above it, so it's known that the try-catch depends on this external runtime bug
      • There's another throw site for a different runtime: isBuildingSnapshot() (see: https://github.com/oven-sh/bun/issues/32501). Though bun has patched this quickly, we're still inoperable across much of bun on 7.3.x. For this reason, we should add a try catch here too. Same callout, different link

      Testing Requirements

      • Stubs which throw on getBuiltinModule & isBuildingSnapshot can be used as test primers

      Documentation Requirements

      • N/A

      Follow Up Requirements

      • N/A

       

       

       

            Assignee:
            Johnathan Martell
            Reporter:
            Allan Chau (EXT)
            None
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: