tRPCttRPC
Powered by
BillyBobB
tRPC•3y ago•
21 replies
BillyBob

tRPC, NextJS 14, createTRPCProxyClient, How can I globally manage errors?

I want to be able to redirect a user when they become unauthenticated. Someone else mentioned to create some NextJS middleware which makes an api call for the user but then that will make an extra API call for every tRPC request. It feels like there should be someway I can centrally manage errors where if tRPC returns an 'UNAUTHORIZED' error for any procedure I can do a redirect to '/login'
I have a monorepo with everything together but the apps will be deployed separately eventually.
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

createTRPCNext and createTRPCProxyClient within one NextJs app
hov_sHhov_s / ❓-help
3y ago
How to manage custom errors (e.g. custom error codes) in tRPC?
sh03Ssh03 / ❓-help
3y ago
Express tRPC NextJS
MugetsuMMugetsu / ❓-help
3y ago
NextJS + TRPC + NX
CaptainCCaptain / ❓-help
4y ago