Next.js Discord

Discord Forum

Middlware not running next 16.1.6

Unanswered
Netherland Dwarf posted this in #help-forum
Open in Discord
Netherland DwarfOP
Hi, my proxy file is not running. I have version 16.1.6, and named the file proxy in the root level of my app.

5 Replies

Netherland DwarfOP
export default clerkMiddleware(async (auth, request: NextRequest) => {
    

    throw new Error('Middleware error test');

});
export const config = {
    matcher: [
        // Skip Next.js internals and all static files, unless found in search params
        '/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)',
        // Always run for API routes
        '/(api|trpc)(.*)',
    ],
};
thats my middleware
named proxy.ts
if you are using src dir, you are supposed to place it inside src/proxy.[js|ts]