Skip to content

nested Middleware is not allowed (found pages/_middleware) #37318

@michalstrzelecki

Description

@michalstrzelecki

Verify canary release

  • I verified that the issue exists in Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022
Binaries:
  Node: 16.5.0
  npm: 7.21.1
  Yarn: N/A
  pnpm: N/A
Relevant packages:
  next: 12.1.7-canary.24
  react: 18.1.0
  react-dom: 18.1.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

I am using react 18 and next canary release. When I create middleware page and run npm run dev I get:

error - nested Middleware is not allowed (found pages/_middleware) - https://nextjs.org/docs/messages/nested-middleware

in the console.

Expected Behavior

I want to be able to use middleware feature with react 18.

To Reproduce

https://github.com/michalstrzelecki/nestedMiddlewareIsNotAllowed

Metadata

Metadata

Assignees

No one assigned

    Labels

    MiddlewareRelated to Next.js Middleware.bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions