t3dotgg / chirp

https://xn--uo8h.t3.gg/
394 stars 62 forks source link

When log out flow is added, no publicProcedure works #28

Closed zogss closed 1 year ago

zogss commented 1 year ago

I tried forward with Clerk but when I added log out flow no query in trpc worked. I tried to add a public route in clerk middleware, but not worked too.

zogss commented 1 year ago

Fixed!

I found that i also have to add the api path in the publicRoutes array.

import { authMiddleware } from "@clerk/nextjs";

export default authMiddleware({
  publicRoutes: ["/", "/:slug", "/post/:id", "/api/trpc/(posts)(.*)"],
});

export const config = {
  matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};