NextJS 14 await is not defined

XMLWordPrintableJSON

    • Type: Build Failure
    • Resolution: Works as Designed
    • Priority: Unknown
    • None
    • Affects Version/s: bson-6.3.0
    • Component/s: BSON
    • 1
    • Not Needed
    • None
    • 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?
    • None
    • None
    • None
    • None
    • None
    • None

      When importing bson into an async function, NextJS throws an error stating:

      //
       ⨯ node_modules/bson/lib/bson.mjs (131:26) @ eval
       ⨯ ReferenceError: await is not defined
          at __webpack_require__ (/Users/somnus/WebstormProjects/nextjs-playground/.next/server/webpack-runtime.js:33:43)
          at eval (./src/lib/updateMongoOrder.ts:11:62)
          at (action-browser)/./src/lib/updateMongoOrder.ts (/Users/somnus/WebstormProjects/nextjs-playground/.next/server/app/[orgSlug]/order/[id]/page.js:535:1)
          at Function.__webpack_require__ (/Users/somnus/WebstormProjects/nextjs-playground/.next/server/webpack-runtime.js:33:43)
      

            Assignee:
            Neal Beeken
            Reporter:
            Cody Woodside
            None
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: