Theo's Typesafe CultTTC
Theo's Typesafe Cult4y ago
108 replies
fotoflo

trpc first callH

Hi there! I'm trying to create my first trpc route, trying to copy the example route

1. Define a router in
src/server/trpc/router/route_name
;
2. Import and register the router in
src/tprc/router/_app

3. import the router into the component from
src/utils/trpc";

4. Call the registered route

1, url router
export const urlRouter = router({
  create: publicProcedure.input(urlFormSchema).query(async () => {
    console.log("RUNNING CREATE URL");
  }),
...

2. _app
export const appRouter = router({
  urls: urlRouter,
});


3. component
    trpc.urls.create();


4. ERROR in the component
Unhandled Runtime Error
TypeError: hooks[lastArg] is not a function

Any idea why im getting this error? is urls not registered correctly or?
image.png
Was this page helpful?