T
tRPC

Cannot read properties of undefined (reading 'trpc')

Cannot read properties of undefined (reading 'trpc')

Ffisher7/2/2023
I keep getting that when trying to make an api request with my next.js page. I am using the latest Next.js version with app router enabled.
Ffisher7/2/2023
nevermind, fixed!
Ooscartorres108/3/2023
Hey @j.fisher! I'm getting the same error, how did you fix it?
Ooscartorres108/3/2023
No description
Ooscartorres108/4/2023
Just solved it, I was trying to use the api imported from server on a component with the use client directive, and I fixed it by switching the import to the client, like this: import { api } from '@/trpc/client' Got the idea from this repo: https://github.com/trpc/examples-next-app-dir
No description

Looking for more? Join the community!

T
tRPC

Cannot read properties of undefined (reading 'trpc')

Join Server
Recommended Posts
Does SSG / ServerSideHelpers allow for mutations in getServerSideProps Nextjs ?Hi, I have a use case where I send the user to a payment portal, and the payment portal can send theCan someone explain MiddlewareFunction?I am trying to create a custommiddleware.ts file and I would like some explanation on what goes intoHow do I get the queries and mutations list in v10?Hello, In tRPC v9 I can do: ``` const queries = Object.keys(appRouter._def.queries); const mutatiIssues with subrouters being treated as any on clientI have 3 sub routers, all with a hello query just returning an object with world. I'm using nextjs wtRPC + Express + Open TelemetryI'm wondering if anyone has experience using tRPC in conjunction with Express and Open Telemetry. I'Strange trpc typesHello, I just installed a fresh `trpc` project with `prisma` and `next`. I have a prisma schema suchIs there a version of tRPC v10 that works with Next 12?Hi, is there a version of tRPC that works with Next 12 and React 17? We want to incrementally adoptRunning TRPC on Vercel with custom serialization failsHi all, I'm having some difficulties with the serialization of my objects when I run on vercel. I'm How to prefetch data on the client into the cache?To simplify a bit, lets say I'm making an app that allows users to view a project. I have a top leveIt's possible to upload a zip file through trpc?I'm doing a screen where I need to upload a zip with pdfs files, it is possible with trpc? or I needroute needs jwt but it doesn'thi i do have a public route but when i i call it on the front end it requires a jwt token SERVER imcall socket.io events from inside trpc endpoints?how do i implement notifications when someone likes a post with socket.io? will every user have his