TYPeee

A Node.js API is used (process.cwd) which is not supported in the Edge Runtime.

Situation

Using process.cwd() in middlware.js

Reason

Next.js middleware currently only supports the Edge runtime. The Node.js runtime can not be used

Solution

  • Make route handler for the API and use it
  • Use the API in next.config if you can

Related Posts