tRPCttRPC
Powered by
MugetsuM
tRPC•4y ago•
17 replies
Mugetsu

NextJs middleware broken by tRPC

Hi, I have a NextJs middleware that is redirecting to the login page. Basically an Auth guard over my all pages and apis but I have a problem with tRPC api routes. Whenever NextJs middleware pickup
/api/trpc
/api/trpc
call and there is no session it tries to redirect to the login page breaking the redirect and trpc itself. Is there a way to get this working so redirect would actually work as expected?
Screenshot_2022-10-25_at_01.30.47.png
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

nextjs middleware trpc authentication
chicoCchico / ❓-help
16mo ago
Return TRPC Error from NextJS middleware
TomTTom / ❓-help
3y ago
trpc middleware
PTIT-NeikkkPPTIT-Neikkk / ❓-help
3y ago
trpc pipe middleware
rustclanRrustclan / ❓-help
3y ago