New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Middleware won't deploy in subpath with error no-server-import-in-page with React Server Components and concurrentFeatures #32467
Comments
This should have been fixed by #32139, but it looks like it wasn't. It reproduces with 12.0.8-canary.5 on my machine as you described. This is an ESLint issue, something being wrong in https://github.com/thibautsabot/next.js/blob/canary/packages/eslint-plugin-next/lib/rules/no-server-import-in-page.js @thibautsabot any ideas?
That's already reported and in the backlog, so that's a duplicate of #31803. |
Given that has been a common error with eslint rules, I'm proposing a common utility that uses This could also require doing an additional check with I think it would be a good idea to switch any code checking for a filename to the above. There are multiple rules that check for Edit: With a common utility it would also be easier for future contributors. |
Hey! Really sorry about the hiccup 🙏 . I'm unable to reproduce it with |
@thibautsabot I forgot to check if I upgraded the ESLint plugin as well. 🤦♂️. Once I get home I'll try again.. 👀 |
@thibautsabot is totally right. This has been fixed in |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
12.0.8-canary.4
What version of Node.js are you using?
local: 14.8.1 // vercel: 12
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
When deploying an NextJs App to Vercel, with having a _middleware.js / _middleware.ts in a sub-path of pages, e.g.
/pages/dashboard/_middleware.ts
the build fails with:
Error: next/server should not be imported outside of pages/_middleware.js. See https://nextjs.org/docs/messages/no-server-import-in-page. @next/next/no-server-import-in-page
Expected Behavior
Deploy sucessfully
To Reproduce
With:
concurrentFeatures: true
serverComponents: true
Add:
/pages/test/_middleware.js
The text was updated successfully, but these errors were encountered: