Hi everyone,
I'm trying to use payload cms 3.0 with middleware.ts
to do check user auth, but I'm encountering a Node error during the build process. Here's the error message:
Module build failed: UnhandledSchemeError: Reading from "node:os" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
I'm not very familiar with this error. Has anyone else faced this when using Payload CMS with middleware in Next.js? Any guidance on how to fix it or what plugin might be needed would be greatly appreciated!
Ref: https://nextjs.org/docs/app/building-your-application/routing/middleware#runtime
Middleware currently only supports the Edge runtime. The Node.js runtime can not be used.
I think you should move your auth check into a higher level layout instead.
Thank you, Mr. andershermansen
Star
Discord
online
Get dedicated engineering support directly from the Payload team.