Error while creating a mutation in NextJS

I am having the following error:
"message": "No \"query\"-procedure on path \"checkout.stripe\"",
"code": -32004,
"message": "No \"query\"-procedure on path \"checkout.stripe\"",
"code": -32004,
Here is my code:
import { createTRPCRouter, publicProcedure } from "@/server/api/trpc";

export const checkoutRouter = createTRPCRouter({
stripe: publicProcedure.mutation(() => {
return "Hello";
}),
});
import { createTRPCRouter, publicProcedure } from "@/server/api/trpc";

export const checkoutRouter = createTRPCRouter({
stripe: publicProcedure.mutation(() => {
return "Hello";
}),
});
If I go to http://localhost:3000/api/trpc/checkout.stripe it throws that error, any ideas?
Nick
Nick223d ago
Where are you attaching checkoutRouter?
Tarky
Tarky223d ago
In the root file, where all my routes go I am using the T3 stack here is the root.ts file
import { exampleRouter } from "@/server/api/routers/example";
import { imageRouter } from "@/server/api/routers/image";
import { checkoutRouter } from "@/server/api/routers/checkout";
import { createTRPCRouter } from "@/server/api/trpc";

/**
* This is the primary router for your server.
*
* All routers added in /api/routers should be manually added here.
*/
export const appRouter = createTRPCRouter({
example: exampleRouter,
image: imageRouter,
checkout: checkoutRouter,
});

// export type definition of API
export type AppRouter = typeof appRouter;
import { exampleRouter } from "@/server/api/routers/example";
import { imageRouter } from "@/server/api/routers/image";
import { checkoutRouter } from "@/server/api/routers/checkout";
import { createTRPCRouter } from "@/server/api/trpc";

/**
* This is the primary router for your server.
*
* All routers added in /api/routers should be manually added here.
*/
export const appRouter = createTRPCRouter({
example: exampleRouter,
image: imageRouter,
checkout: checkoutRouter,
});

// export type definition of API
export type AppRouter = typeof appRouter;
Nick
Nick222d ago
Oh I see it, you're calling a query for a mutation procedure
Tarky
Tarky222d ago
What do you mean?
Nick
Nick222d ago
publicProcedure.mutation No "query"-procedure on path "checkout.stripe" It has to be one or the other
More Posts
trpc PaginationDoes somebody have any example how can i do pagination in trpc and react query?Auth through trpc proceduresHas Anyone Successfully Implemented Supabase Auth through tRPC Procedures in a Next.js App? Hello esupabase + trpcdid anyone handle to make it work -> context and all signup signin etc methods?How to update query data after mutationAny idea?standaloneMiddleware: Merge ctx/meta/input typesUsing standaloneMiddleware, it would be great to merge the types (ctx, input, meta) with what is alrDoes `fetchRequestHandler()` automatically opt out of /app Route Handler caching?I noticed that Next.js always skips cache for my TRPC API Route Handlers even though the request URLCold Boot OptimizationsI have a next.js app that uses trcp for all of the routes. I am noticing cold boots are slow. It is Cancel useQueries with single functionis there a way to abort useQueries with function call (e.g. cancel, abort)?There is a logger middleware like morgan for express?There is a package with a nice logger middleware? ThanksImplementing wsLink causes issues on ReactI get an error within the console stating ``` Uncaught (in promise) TypeError: Cannot read propertieUnderstanding how too reuse TRPC with React Server ComponentsHopefully I am understanding this correctly, but I have created a `experimental_createTRPCNextAppDirWhat would be considered best practice for getting data and invalidating queries?I have a really simple task management app (doing it to learn stuff). Tasks are grouped in projects Calls to specific table not working in production, fine locallyI am having a strange issue since yesterday. I am using nextjs TRPC and Prisma to connect to a planeanyone else getting a failed to fetch in latest next versionsnot sure if this is happening to more people, I tried literally everything, changing to 127.0.01, upMissing keys in TRPCError when returning as JSONHey all! I am returning a TRPCError from a custom TRPC server but only the code and name keys seems How to close a Standalone adapter server?I want to run some integration tests with Vitest and for some reason I don't want to use the `createtRPC Client within Next.js but with external standalone server?Hi, I have an old Next.js project that used tRPC and we're currently in the process of separating oReview of inner and outer context with expressHello, I didn't find any example that uses inner (for testing) and outer context with express. That