Open
Description
Checklist
- The issue can be reproduced in the nextjs-auth0 sample app (or N/A).
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
I'm on v4.0.0-beta.14 and stuck. For my usecase, I need access to the database in beforeSessionSaved
so I can save a userId
along with some other parameters in the session context.
In v4, the callback runs in the Next.js edge runtime, which is quite a bit limited compared to the regular runtime. I am unable to use my sequelize postgres setup, here's the stack trace
upport Node.js 'tty' module.
Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime
at <unknown> (webpack-internal:///(middleware)/./node_modules/next/dist/esm/server/web/globals.js:43)
at Object.apply (webpack-internal:///(middleware)/./node_modules/next/dist/esm/server/web/globals.js:43:19)
at eval (webpack-internal:///(middleware)/./node_modules/colorette/index.cjs:39:61)
at (middleware)/./node_modules/colorette/index.cjs (file:///Users/aneesiqbal/Projects/shw/app/projects/webapp/.next/server/src/middleware.js:31226:1)
at __webpack_require__ (file:///Users/aneesiqbal/Projects/shw/app/projects/webapp/.next/server/edge-runtime-webpack.js:37:33)
at fn (file:///Users/aneesiqbal/Projects/shw/app/projects/webapp/.next/server/edge-runtime-webpack.js:315:21)
at eval (webpack-internal:///(middleware)/./node_modules/pino-pretty/index.js:3:30)
at (middleware)/./node_modules/pino-pretty/index.js (file:///Users/aneesiqbal/Projects/shw/app/projects/webapp/.next/server/src/middleware.js:31248:1)
at __webpack_require__ (file:///Users/aneesiqbal/Projects/shw/app/projects/webapp/.next/server/edge-runtime-webpack.js:37:33)
at fn (file:///Users/aneesiqbal/Projects/shw/app/projects/webapp/.next/server/edge-runtime-webpack.js:315:21)
at eval (webpack-internal:///(middleware)/./src/server/utils/base-logger.ts:8:69)
⚠ ./node_modules/sequelize/lib/dialects/abstract/connection-manager.js
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
./node_modules/sequelize/lib/dialects/abstract/connection-manager.js
./node_modules/sequelize/lib/dialects/sqlite/connection-manager.js
./node_modules/sequelize/lib/dialects/sqlite/index.js
./node_modules/sequelize/lib/sequelize.js
./node_modules/sequelize/lib/index.js
./node_modules/sequelize/lib/index.mjs
./src/server/services/auth/authClient.ts
Reproduction
Not relevant given that this is a pretty well known limitation of the edge runtime
Additional context
No response
nextjs-auth0 version
4.0.0-beta.14
Next.js version
14.2.21
Node.js version
v22.11.0