diff --git a/.changeset/curly-ties-mix.md b/.changeset/curly-ties-mix.md new file mode 100644 index 0000000000..e51e72cb46 --- /dev/null +++ b/.changeset/curly-ties-mix.md @@ -0,0 +1,5 @@ +--- +'@clerk/nextjs': patch +--- + +Fix an issue where only static routes would be allowed by `publicRoutes` prop from `authMiddleware`. diff --git a/packages/nextjs/src/server/authMiddleware.ts b/packages/nextjs/src/server/authMiddleware.ts index 77fee7de8f..f823fa45fa 100644 --- a/packages/nextjs/src/server/authMiddleware.ts +++ b/packages/nextjs/src/server/authMiddleware.ts @@ -39,7 +39,9 @@ type ExcludeRootPath = T extends '/' ? never : T; type RouteMatcherWithNextTypedRoutes = | WithPathPatternWildcard> | NextTypedRoute - | (string & object); + // This is necessary to allow all string, using something other than `{}` here WILL break types! + // eslint-disable-next-line @typescript-eslint/ban-types + | (string & {}); const INFINITE_REDIRECTION_LOOP_COOKIE = '__clerk_redirection_loop';