Aiken Lapin Rowe
Aiken Lapin Rowe
TTCTheo's Typesafe Cult
Created by Aiken Lapin Rowe on 10/17/2023 in #questions
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?
6 replies
TTCTheo's Typesafe Cult
Created by Aiken Lapin Rowe on 9/20/2023 in #questions
Issues creating public route after adding Clerk auth
After adding Clerk to my application, all API routes return a 401, even the public one gets a 401 unauthorized error. I need help with this promptly, and I am willing to pay whoever can support me in an 1on1 session. Chat and call is fine. I am running the same tech stack as shown in Theos T3 stack tutorial (https://www.youtube.com/watch?v=YkOSUVzOAA4&t=2025s) and this issue is on the step where Clerk is added. This is probably some dumb simple bug, but I am stuck on this and need assistance as soon as possible. Please reach out.
6 replies