Open
Description
Adapter type
@auth/prisma-adapter
Environment
System:
OS: macOS 15.5
CPU: (12) arm64 Apple M4 Pro
Memory: 4.41 GB / 48.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.16.0 - ~/.nvm/versions/node/v22.16.0/bin/node
npm: 11.4.1 - ~/.nvm/versions/node/v22.16.0/bin/npm
pnpm: 10.11.1 - ~/.nvm/versions/node/v22.16.0/bin/pnpm
Browsers:
Chrome: 137.0.7151.120
Edge: 137.0.3296.83
Safari: 18.5
npmPackages:
@auth/prisma-adapter: ^2.9.1 => 2.9.1
@auth/unstorage-adapter: ^2.0.0 => 2.9.1
next: latest => 15.3.4
next-auth: beta => 5.0.0-beta.28
react: ^18.2.0 => 18.3.1
Reproduction URL
https://github.com/karl-barbour/prisma-adapter-bug
Describe the issue
As per the closed issue #13035 raised by @Stadly
The Prisma adapter imports from @prisma/client. This does not work when using a custom output path in the Prisma generator.
Prisma strongly recommends using a custom output path. Not doing so results in a warning in version 6.6.0, and it will be required in version 7. Also, the new prisma-client generator requires a custom output path.
How to reproduce
Create a schema with a custom Prisma output path.
prisma/schema.prisma
...
generator client {
provider = "prisma-client-js"
output = "./generated/client"
}
...
(This repo uses GitHub as a provider)
- Generate client:
pnpm prisma generate
(will needpnpm prisma migrate dev
if empty database) - Run next:
pnpm dev
- Browse to
http://localhost:3000
- Receive error:
> @ dev /Users/Karl.Barbour/git/prisma-adapter-bug
> next
▲ Next.js 15.3.4
- Local: http://localhost:3000
- Network: http://10.4.82.149:3000
- Environments: .env
✓ Starting...
✓ Ready in 1241ms
⨯ ./node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@prisma/client/default.js:2:1
Module not found: Can't resolve '.prisma/client/default'
1 | module.exports = {
> 2 | ...require('.prisma/client/default'),
| ^
3 | }
4 |
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]__typesc_bbc972bb237e83a96bb1b898008cba97/node_modules/@auth/prisma-adapter/index.js
./auth.ts
./middleware.ts
⨯ ./node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@prisma/client/default.js:2:1
Module not found: Can't resolve '.prisma/client/default'
1 | module.exports = {
> 2 | ...require('.prisma/client/default'),
| ^
3 | }
4 |
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]__typesc_bbc972bb237e83a96bb1b898008cba97/node_modules/@auth/prisma-adapter/index.js
./auth.ts
./middleware.ts
○ Compiling /middleware ...
✓ Compiled /_error in 246ms (360 modules)
GET / 404 in 2ms
○ Compiling /favicon.ico ...
✓ Compiled /favicon.ico in 1238ms (1525 modules)
✓ Compiled in 166ms (1511 modules)
Expected behavior
Auth.js should not import Prisma
and PrismaClient
from @prisma/client
.