Replies: 1 comment 3 replies
-
|
Hello. Middleware are run on the edge runtime which is based on the standard Web API. See https://nextjs.org/docs/api-reference/edge-runtime#unsupported-apis |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It seems that middlewares are VERY sensitive to how modules get exported. I get
Module not found: Can't resolve 'fs'when trying to implement them.At first the stack looked like this:
Fine, something is wrong with my re-exports and
json-schema-to-typescriptprobably does something to file system.Split exports around.
Then I get this:
Looks like re-export problem again, now with
nodemailer.Split exports around.
The next one is baffling though:
This one can't be fixed by rearranging the modules, since this stack is for a function which does a database call (the whole purpose of this middleware).
At this point I realized I don't even know what is the problem. Aren't middlewares server-only? Why would having
fsbe a problem?Beta Was this translation helpful? Give feedback.
All reactions