Spudfella
Spudfella2mo ago

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);
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))
})
}
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))
})
}
0 Replies
No replies yetBe the first to reply to this messageJoin