nextjs - 💡(How to fix) Fix next .js [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#85460Fetched 2026-04-08 02:15:38
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
closed ×1commented ×1labeled ×1locked ×1
RAW_BUFFERClick to expand / collapse

Next.js Version 15.5.6 OS Windows Node.js Version 22.14.0 Description Middleware file is completely ignored by Next.js in a clean App Router setup. The file is correctly placed in the project root and includes return NextResponse.next(). No console.log output is shown in the terminal. What You Tried 1. Removed all conflicting dependencies (iron-session, bun). 2. Deleted .next and node_modules folders and reinstalled. 3. Used both .js and .mjs extensions. 4. Used matcher: ['/:path*'] in config. Reproduction (Middleware.js Code) javascript import { NextResponse } from 'next/server'; export async function middleware(request) { console.log("--- MIDDLEWARE IS NOT RUNNING ---"); return NextResponse.next(); } export const config = { matcher: ['/:path*'], }; Reproduction (package.json) (Apni poori package.json file yahaan daalein)

extent analysis

TL;DR

The middleware file might be ignored due to incorrect configuration or file placement in the Next.js App Router setup.

Guidance

  • Verify that the middleware.js file is correctly placed in the project root and exported as a default export or named export that Next.js can recognize.
  • Check the Next.js documentation for the correct configuration of middleware in an App Router setup, ensuring that the matcher property is correctly defined and the middleware function is properly exported.
  • Confirm that the next/server module is correctly imported and used in the middleware.js file.
  • Try to simplify the middleware function to only log a message or return a response, to isolate if the issue is with the function itself or the configuration.

Example

// middleware.js
import { NextResponse } from 'next/server';

export async function middleware(request) {
  console.log("--- MIDDLEWARE IS RUNNING ---");
  return NextResponse.next();
}

Notes

The provided information suggests that the issue might be related to the configuration or placement of the middleware file, but without more details about the project structure and configuration, it's difficult to provide a more specific solution.

Recommendation

Apply workaround: Try to simplify the middleware configuration and function to isolate the issue, and then gradually add back the original functionality to identify the root cause.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING