Tribe
Tribe11mo ago

Dynamic Server Usage Error from RSC calls

posted this on the create-t3-app server as well but not quite sure if the issue is T3 or TRPC related. But hoping I can at least get a recommendation from someone here. Essentially, making a TRPC call from any RSC component causes the build process to throw a dynamic server error. The app still appears to build but I am obviously concerned about the health of the project moving forward. I have found a handful of workarounds but they all seem rather hacky. Could anyone offer some advice how to approach this or are people just forcing dynamic rendering at the top of the file and moving on? Thanks in advance.
No description
5 Replies
Alex / KATT 🐱
Alex / KATT 🐱11mo ago
Sounds like it could bug as we got a similar report in our issues today, please open an issue with a repro? I can fix tomorrow
Tribe
TribeOP11mo ago
open it on t3 repo?
Alex / KATT 🐱
Alex / KATT 🐱11mo ago
Trpc
Tribe
TribeOP11mo ago
will do, thanks
Keelan Gibb
Keelan Gibb11mo ago
export const dynamic = "force-static"; This makes the build run by forcing all dynamic functions like headers and cookies to return empty values. This is not ideal because every RSC trpc call will need this at the top but this lets these be static pages instead of dynamic ones at the cost of disabling headers and cookies. calling cookies() inside the RSC (not the createContext func) or setting the variable to force-dynamic instead will also fix the build issues but it turns them into dynamic pages.