next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

@auth/prisma-adapter creating error on import line at auth.ts

Open ezeamin opened this issue 8 months ago • 0 comments

Adapter type

@auth/prisma-adapter

Environment

  System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 13th Gen Intel(R) Core(TM) i5-1340P
    Memory: 2.26 GB / 15.56 GB
  Binaries:
    Node: 20.12.2 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.9.0 - ~\AppData\Local\pnpm\pnpm.CMD
    bun: 1.2.7 - ~\.bun\bin\bun.EXE
  Browsers:
    Edge: Chromium (134.0.3124.93)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    @auth/prisma-adapter: ^2.9.0 => 2.9.0
    next: 15.3.1 => 15.3.1
    next-auth: ^5.0.0-beta.27 => 5.0.0-beta.27
    react: ^19.1.0 => 19.1.0

Reproduction URL

https://github.com/ezeamin/next-auth-test

Describe the issue

When runing bun dev on an empty nextjs 15 project (with prisma and next-auth), it crashes when starting. Happens both with and without turbopack, showing different information about the same error:

With turbo:

⨯ Error: Failed to load external module node:module: ReferenceError: Cannot access 'require' before initialization
    at Object.externalRequire [as x] (.next\server\edge\chunks\edge-wrapper_203abea8.js:1448:15)
    at <unknown> (.next\server\edge\chunks\edge-wrapper_203abea8.js:722:27)
    at runModuleExecutionHooks (.next\server\edge\chunks\edge-wrapper_203abea8.js:768:9)
    at instantiateModule (.next\server\edge\chunks\edge-wrapper_203abea8.js:720:9)
    at getOrInstantiateModuleFromParent (.next\server\edge\chunks\edge-wrapper_203abea8.js:653:12)
    at esmImport (.next\server\edge\chunks\edge-wrapper_203abea8.js:143:20)
    at <unknown> (.next\server\edge\chunks\edge-wrapper_203abea8.js:722:27)
    at runModuleExecutionHooks (.next\server\edge\chunks\edge-wrapper_203abea8.js:768:9)
 ○ Compiling /_not-found/page ...
 ✓ Compiled /_not-found/page in 1388ms

With webpack:

○ Compiling /middleware ...
 ⨯ node:child_process
Module build failed: UnhandledSchemeError: Reading from "node:child_process" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
Import trace for requested module:
node:child_process
./node_modules/@prisma/client/runtime/library.mjs
./node_modules/@auth/prisma-adapter/index.js
./src/auth.ts
<w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (196kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)
 ✓ Compiled /_error in 1584ms (367 modules)

This happens with bun and npm. Tried erasing .next and node_modules folders, using other package managers, without success. Used docker as well to ensure env free errors, but it's also showing the same error.

How to reproduce

  1. Run bun dev
  2. Go to http://localhost:3000
  3. You'll see the error showing on screen.

Image

Expected behavior

To run the app without any problem.

ezeamin avatar Apr 28 '25 00:04 ezeamin