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

NextJS 14 await is not defined

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

      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@mongodb.com Neal Beeken
            Reporter:
            blackstarxr253@gmail.com Cody Woodside
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: