Liltripple_reidL
tRPC3y ago
5 replies
Liltripple_reid

`createCaller` and RSC - with next-auth

I've been upgrading my trpc routers and handlers to support edge+app router with drizzle and next-auth; and something that has come up is the use of createCaller (with createTRPCNext instead of createTRPCReact - and without the TRPCProvider). So I wanted to ask if this is a correct way of using that function

// app/_trpc/server-client.tsx
import { type Session } from "next-auth";
import { appRouter } from "~/server/api/root";

export const serverClient = ({ session }: { session: Session | null }) => {
  return appRouter.createCaller({ session });
};
Was this page helpful?