tRPC route undefined at runtime
I'm getting a 500 error in my dev environment
[ Server ] Error: Cannot read properties of undefined (reading 'getAllForUser')
for a trpc query I added. It's the same getLatest
query for posts just changed to findMany
instead of findFirst
. I'm struggling to figure out what could make the site compile and have getLatest working but then have getAllForUser
missing at runtime. The site is working fine locally using railway db and discord auth and only breaks once I try to add a component for getting all user books (reworded from the posts example)
Repo public here
https://github.com/TiKevin83/DiveableNext/blob/e664211df268ff843544db98c0baeec9a11f4d2e/src/server/api/routers/book.ts#L29GitHub
DiveableNext/src/server/api/routers/book.ts at e664211df268ff843544...
Porting my Diveable Book Layer Visualization to Next.js - TiKevin83/DiveableNext
1 Reply
I just needed to add the
"use client";
directive at the top of the page to match the other component that was grabbing api data. This wasn't a thing the last time I built a site on T3 as far as I remember