edgeFunction is not a function
Unanswered
Le Conte's Thrasher posted this in #help-forum
Le Conte's ThrasherOP
I have a chain of middlewares set up based on this repo: https://github.com/HamedBahram/next-middleware-chain/tree/main
Middlewares are working fine. But if I add a middleware that asynchronously gets data from my db (using mongoose), the server throws the following error. No idea why or what I can do about this.
Middlewares are working fine. But if I add a middleware that asynchronously gets data from my db (using mongoose), the server throws the following error. No idea why or what I can do about this.
Error [TypeError]: edgeFunction is not a function
at runWithTaggedErrors (path/to/project/node_modules/next/dist/server/web/sandbox/sandbox.js:96:30)
at async DevServer.runMiddleware (path/to/project/node_modules/next/dist/server/next-server.js:964:24)
at async DevServer.runMiddleware (path/to/project/node_modules/next/dist/server/dev/next-dev-server.js:251:28)
at async DevServer.handleCatchallMiddlewareRequest (path/to/project/node_modules/next/dist/server/next-server.js:1053:22)
at async DevServer.handleRequestImpl (path/to/project/node_modules/next/dist/server/base-server.js:736:32) {
middleware: true
}1 Reply
Le Conte's ThrasherOP
I just learned that middleware is forced to use edge runtime....where in the docs is this? Nothing about edge runtime here: https://nextjs.org/docs/app/building-your-application/routing/middleware