The error message you're seeing is due to the fact that Next.js does not support the use of middleware when you're exporting your application as static HTML. This is because middleware in Next.js runs at the edge, which means it runs on the server side and not on the client side. When you're exporting your application as static HTML using output: "export", there is no server to run the middleware.
If you need to use middleware in your application, you will need to deploy your application in a way that includes a server. This could be a traditional server, a serverless function, or a similar environment. If you're deploying to Vercel, this is handled for you automatically.
If you don't need to use middleware, you can remove or comment out the middleware code and the error should be resolved.
For more information, you can refer to the Next.js documentation on middleware (https://nextjs.org/docs/middleware/introduction) and static HTML export (https://nextjs.org/docs/advanced-features/static-html-export).
Sources:
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: