bigshot824B
tRPC8mo ago
2 replies
bigshot824

NextJS trpc caller and Hono

Hi, do you manage to use appRouter.createCaller? I have nextjs and hono backend separate. I wanted to use caller in server components. I have this in my hono context and on my screenshot was the appRouterCaller. I'm having difficulty to access the context.

Hope you can help.

import type { Context as HonoContext } from "hono"
import { auth } from "./auth"

export type CreateContextOptions = {
    context: HonoContext
}

export async function createContext({ context }: CreateContextOptions) {
    const session = await auth.api.getSession({
        headers: context.req.raw.headers
    })

    return { session }
}
Was this page helpful?