hashwarpH
tRPC17mo ago
1 reply
hashwarp

createCaller is returning [Function: noop]

env: node 20 pnpm

I'm trying to call procedures locally, and when I console log the router, I see the trpc object ({mutations: ..., etc.})

But when I create the caller, it returns noop, and anything I call on that is noop. Ideas?

client.emit = createRouter(service);

const createCaller = createCallerFactory(client.emit);
const caller = createCaller({ client );
const result = await caller.connected(params);


router:

export const createRouter = (service: Schema.Service) => {
  return router({
    connected: procedure
      .use(hasRole('realm', t))
      .use(customErrorFormatter(t))
      .input(schema.connected)
      .mutation(({ input, ctx }) => service.connected(input as Schema.ConnectedInput, ctx))
  })
}
Was this page helpful?