tRPCttRPC
Powered by
denik1981D
tRPC•4y ago•
1 reply
denik1981

Is it ok to use a createCaller() router within ServerSideProps?

The official trpc docs shown an example of how to use the SSGHelper router within SSPs. The procedure I wanna use needs the session object within the context. This procedure is shared by the public API trpc router thus I wouldn't want to create a different procedure that will do the same but taking the session information from someplace else.

I was able to create a server side only router with createCaller and tne innerContext as suggested and it is working perfectly inside SSPs.
Is there any CAVEAT regarding using this type of reouter instead the SSG provided. I do understand that I won't be able to prefetch and hydrate the page, but apart from that, is there anything that I should be aware of.

My particular use case was not feeding props into the page but to get a value from the user procedure that wil later allow to redirect to another path. This is working great with the SSO router but I'm planning to use it later for a traditional SSP props feed operation.
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

CreateCaller for router with AWS Adapters
MaxMMax / ❓-help
11mo ago
is it possible to use trpc without the app router?
tltlTtltl / ❓-help
17mo ago
How to use createCaller() with lambda for testing?
ferdyFferdy / ❓-help
3y ago
createCaller is returning [Function: noop]
hashwarpHhashwarp / ❓-help
2y ago