3 ms·
Middleware will soon support using the Node.js runtime, if you want. However, you still shouldn't run blocking database queries there. There's where the framewo
by leerob 2y ago
Middleware will soon support using the Node.js runtime, if you want. However, you still shouldn't run blocking database queries there. There's where the framework is currently trying to push you towards, but not doing so well enough to understand that tradeoff. That's why there is a supplemental API being added: https://github.com/vercel/next.js/pull/70961 https://github.com/vercel/next.js/pull/70961
- tommy_axle 2y agoGood to hear. Even with edge you can have a request that blocks or does something silly so IMO it should have had node from the beginning. A common use case is verifying a session or authorization for an entire area.
- leerob 2y agoUnfortunately, that's an anti-pattern here if you are making a request. If you're just checking cookies, then yes that makes sense. The documentation on auth for Next.js tries to make this clear, but my feeling is that "middleware" was a bad name and it came off like we were trying to do Express middleware 1:1.