Submit server form action with tRPC in T3

In theos most recent video on server actions in nextjs using the T3 stack, he gets an error https://youtu.be/PmBfq-SpzCU?si=kq1IhqH6-iptkh8v&t=508. I didn't catch what he did to solve it. I'm trying to do something similar. In my case, i just want to create a db entry using tRPC as a server action. This function is used as an action in a form. const handleAddStore = async () => { "use server"; await api.store.create.mutate(); revalidatePath("/store"); }; This is the trpc procedure. create: protectedProcedure.mutation(async ({ ctx }) => createNewStore(ctx.session.user.id, ctx.db, "Ny affär"), ), I get this error: Unhandled Runtime Error Error: fetch failed Call Stack TRPCClientError.from node_modules@trpc\client\dist\TRPCClientError-0de4d231.mjs (37:15) from node_modules@trpc\client\dist\httpBatchLink-204206a5.mjs (200:55)
Theo - t3․gg
YouTube
This took us too long, I'm sorry
GITHUB LINK https://github.com/t3-oss/create-t3-app So proud of the entire Create-t3-app team for this massive ship. The T3 Stack has never been better. APP ROUTER IS HERE. Check out my Twitch, Twitter, Discord more at https://t3.gg S/O Ph4seOn3 for the awesome edit 🙏
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server