You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maisaan opened this issue
Dec 21, 2024
· 5 comments
Labels
adaptersChanges related to the core code concerning database adaptersbugSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
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/[email protected][email protected][email protected][email protected]/node_modules/next/dist/esm/server/web/globals.js:59:19)
at createSocket (webpack-internal:///(middleware)/./node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js:148:11)
at Timeout.connect [as _onTimeout] (webpack-internal:///(middleware)/./node_modules/.pnpm/[email protected]/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/[email protected][email protected][email protected][email protected]/node_modules/next/dist/esm/server/web/globals.js:59:19)
at createSocket (webpack-internal:///(middleware)/./node_modules/.pnpm/[email protected]/node_modules/postgres/src/connection.js:148:11)
at Timeout.connect [as _onTimeout] (webpack-internal:///(middleware)/./node_modules/.pnpm/[email protected]/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 push to update supabase
Attempt to sign in
Expected behavior
Authenticate user and redirect to home screen
The text was updated successfully, but these errors were encountered:
Maisaan
added
adapters
Changes related to the core code concerning database adapters
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Dec 21, 2024
Yes, been over that. Afaik, DrizzleAdapter is edge compatible, and i wish to use the database strategy because i want to have a finer control over the users, with permissions and roles. When you lazy initialise or split configs you loose database functionality and thats not how i want it.
I encountered a similar error. I was able to resolve it after i removed the import of server side database interaction function from client side related hook. Hope this helps.
I encountered a similar error. I was able to resolve it after i removed the import of server side database interaction function from client side related hook. Hope this helps.
That's good news! Could you please show me how you did it? Thanks!
I uploaded a branch toShowError for you, here. Kindly look into it. Check /test page, here, later check searchUser route handler, here.
I was implementing search feature, had to interact with database. Instead of directly using the database function (which caused the error for me as shown below), which is supposed to be used server side rather than client side, I implemented an api handler for it that indirectly works with the database function.
adaptersChanges related to the core code concerning database adaptersbugSomething isn't workingtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Adapter type
@auth/drizzle-adapter
Environment
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
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
pnpm install
.env.local.example
npx drizzle-kit push
to update supabaseExpected behavior
Authenticate user and redirect to home screen
The text was updated successfully, but these errors were encountered: