Next.js/tRPC Prefetch w/ HydrateClient "Error occurred prerendering page"
Hello all, I'm trying to get to the bottom of an issue I'm having using prefetching with HydrateClient. I'm using the t3 stack, so I believe that HydrateClient is a helper function wrapping tRPC
When I run this code with
Here is the minimum example that I was able to reproduce with:
And the Queue component:
I've tried using both useSuspenseQuery and useQuery in the client component. I'm not sure what I'm doing wrong! Would love to figure out prefetching.
Relevant Versions:
helpers.dehydrate()...When I run this code with
pnpm dev, it works fine, but when I go to pnpm build, I am gettingHere is the minimum example that I was able to reproduce with:
And the Queue component:
I've tried using both useSuspenseQuery and useQuery in the client component. I'm not sure what I'm doing wrong! Would love to figure out prefetching.
Relevant Versions:
Solution
I FIXED IT! Stupid mistake, wasn't marking the root page function as
Broken:
Fix:
async... i.e:Broken:
Fix: