Cyan
Cyan
DTDrizzle Team
Created by Cyan on 10/16/2023 in #help
Drizzle NextJs Middleware
Hello, I'm currently using NextJs middlewares to protect my application. In my middleware, I have a query running to check if the sessionToken is valid. But whenever I visit the protected page I get the following error.
Server Error
TypeError: edgeFunction is not a function

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
runWithTaggedErrors
file:///E:/APPLICATION/node_modules/next/dist/server/web/sandbox/sandbox.js (96:30)
async DevServer.runMiddleware
file:///E:/APPLICATION/node_modules/next/dist/server/next-server.js (962:24)
async DevServer.runMiddleware
file:///E:/APPLICATION/node_modules/next/dist/server/dev/next-dev-server.js (250:28)
async DevServer.handleCatchallMiddlewareRequest
file:///E:/APPLICATION/node_modules/next/dist/server/next-server.js (1051:22)
async DevServer.handleRequestImpl
file:///E:/APPLICATION/node_modules/next/dist/server/base-server.js (736:32)
Server Error
TypeError: edgeFunction is not a function

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
runWithTaggedErrors
file:///E:/APPLICATION/node_modules/next/dist/server/web/sandbox/sandbox.js (96:30)
async DevServer.runMiddleware
file:///E:/APPLICATION/node_modules/next/dist/server/next-server.js (962:24)
async DevServer.runMiddleware
file:///E:/APPLICATION/node_modules/next/dist/server/dev/next-dev-server.js (250:28)
async DevServer.handleCatchallMiddlewareRequest
file:///E:/APPLICATION/node_modules/next/dist/server/next-server.js (1051:22)
async DevServer.handleRequestImpl
file:///E:/APPLICATION/node_modules/next/dist/server/base-server.js (736:32)
Does anyone know how I can fix this? If needed, I can provide some code examples.
5 replies