Exclude dynamic routes in Clerk middleware

I am attempting to exclude all routes for my page /test/[id].tsx This is what my Clerk middleware looks like:
import { authMiddleware } from "@clerk/nextjs";

// This example protects all routes including api/trpc routes
// Please edit this to allow other routes to be public as needed.
// See https://clerk.com/docs/references/nextjs/auth-middleware for more information about configuring your middleware
// TODO: now make this work for dynamic pages
export default authMiddleware({
ignoredRoutes: ["/test/[id]"],
});

export const config = {
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
};
import { authMiddleware } from "@clerk/nextjs";

// This example protects all routes including api/trpc routes
// Please edit this to allow other routes to be public as needed.
// See https://clerk.com/docs/references/nextjs/auth-middleware for more information about configuring your middleware
// TODO: now make this work for dynamic pages
export default authMiddleware({
ignoredRoutes: ["/test/[id]"],
});

export const config = {
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
};
Excluding a single page works fine, but when it comes to dynamic routes, it doesn't work. What am I doing wrong?
Solution:
You should try ignoredRoutes: ['/test/(.*)'] instead
Jump to solution
3 Replies
Solution
teos
teos8mo ago
You should try ignoredRoutes: ['/test/(.*)'] instead
teos
teos8mo ago
Clerk does not use the Next route format (they use regex instead)
Aiken Lapin Rowe
This solved it. Thank you very much.