nextauthjs / nextauthjs/next-auth
[AdapterError] NextAuth with Drizzle Adapter
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 4k
- PR merge metrics
- No merged PRs in 30d
Description
Adapter type
@auth/drizzle-adapter
Environment
System:
OS: macOS 15.2
CPU: (10) arm64 Apple M2 Pro
Memory: 1.09 GB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm
pnpm: 9.7.0 - ~/Library/pnpm/pnpm
Browsers:
Safari: 18.2
npmPackages:
@auth/drizzle-adapter: ^1.7.2 => 1.7.4
next: 15.1.2 => 15.1.2
next-auth: 5.0.0-beta.25 => 5.0.0-beta.25
react: ^19.0.0 => 19.0.0
Reproduction URL
https://github.com/Maisaan/drizzle-adapter-error
Describe the issue
Getting the following errors when trying to access req.auth inside of middleware, when middleware file is deleted this works without errors. I want to setup basic auth redirects.
I have updated next-auth-example template with my code to recreate error
[auth][error] AdapterError: Read more at https://errors.authjs.dev#adaptererror
[auth][cause]: Error: The edge runtime does not support Node.js 'net' module.
Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime
at Object.construct (webpack-internal:///(middleware)/./node_modules/.pnpm/next@15.1.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/esm/server/web/globals.js:59:19)
at createSocket (webpack-internal:///(middleware)/./node_modules/.pnpm/postgres@3.4.5/node_modules/postgres/src/connection.js:148:11)
at Timeout.connect [as _onTimeout] (webpack-internal:///(middleware)/./node_modules/.pnpm/postgres@3.4.5/node_modules/postgres/src/connection.js:345:31)
at listOnTimeout (node:internal/timers:594:17)
at process.processTimers (node:internal/timers:529:7)
[auth][details]: {}
[auth][error] SessionTokenError: Read more at https://errors.authjs.dev#sessiontokenerror
[auth][cause]: Error: The edge runtime does not support Node.js 'net' module.
Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime
at Object.construct (webpack-internal:///(middleware)/./node_modules/.pnpm/next@15.1.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/esm/server/web/globals.js:59:19)
at createSocket (webpack-internal:///(middleware)/./node_modules/.pnpm/postgres@3.4.5/node_modules/postgres/src/connection.js:148:11)
at Timeout.connect [as _onTimeout] (webpack-internal:///(middleware)/./node_modules/.pnpm/postgres@3.4.5/node_modules/postgres/src/connection.js:345:31)
at listOnTimeout (node:internal/timers:594:17)
at process.processTimers (node:internal/timers:529:7)
Instead of a middleware i am currently using an HOC to check if session exists and redirect to auth screen, this is not ideal but works for now.
How to reproduce
- Clone repo and
pnpm install - Create env file as per
.env.local.example - Use
npx drizzle-kit pushto update supabase - Attempt to sign in
Expected behavior
Authenticate user and redirect to home screen
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Clone the linked reproduction, run pnpm install, create the environment file from .env.local.example, push the schema with npx drizzle-kit push, and reproduce the sign-in failure through middleware. Inspect the middleware, the Drizzle adapter setup, and the edge-runtime stack trace; done means authentication and redirecting work without the Node.js net-module error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, node.js, postgres, react, typescript
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100