How to use generateStaticParams with trpc?
I'm going to use generateStaticParams with trpc but it throw me an error.
10 Replies
"ct3aMetadata": {
"initVersion": "7.29.0"
}
why do you want to query the posts from the server in the first place?
Is this in pages router? Looks like you're calling app router code from pages
yes. it's app router
i use it for ssg all post fom db
Uhhh it might be because generateStaticParams isn't a part of the request context
So there's no headers() which is called from tRPC
headers() relies on asynclocalstorage which is created on a per request basis
If you just call your getAllPosts function directly that'll work
i saw headers() in createContext function
with out async await?
async await is fine that should still work
oh. i will call directly prisma to query without tprc
but if i call directly prisma without trpc router. it works with no one error
yeah don't you want it to work?
tRPC calls headers() which is causing the problem
🥲🥲. Ok i think i have a solution
thanks