How to redirect using trpc nextjs base on db query?

This seems less intuitive than it should've.
I'm trying to check if a user is new, if it is then I redirect them to a new page to setup their profile.
So far I've tried to do it with react, trpc, middleware, it doesn't seem to work.

the problem with react is I can't get the current session using clerk with useAuth, and I'd like to redirect before the page starts rendering,.
So I thought I have to go to trpc with the private procecdure where I check if a user is logged in, like trpc, but I can't return any redirect objects because that doesn't fit the middleware return type.
if I use non trpc middle ware where the params are just req and res, I can't get the current user session.
image.png
Was this page helpful?