tRPCttRPC
Powered by
NeoBeanN
tRPC•3y ago•
7 replies
NeoBean

Forward client headers with createTRPCProxyClient & Server-Side Helpers

With
createTRPCNext
createTRPCNext
i had the option to tap into the
context.req
context.req
object nextjs passed in, but I cant achieve the same with
createTRPCProxyClient
createTRPCProxyClient
.

For example below code fails authentication, cause cookies arent forwarded.
export const getServerSideProps: GetServerSideProps = async ctx => {
   ssHelpers.user.profile.prefetch(undefined, { context: ctx })
   return { props: { trpcState: ssHelpers.dehydrate() } }
}
export const getServerSideProps: GetServerSideProps = async ctx => {
   ssHelpers.user.profile.prefetch(undefined, { context: ctx })
   return { props: { trpcState: ssHelpers.dehydrate() } }
}
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Client request headers with createTRPCProxyClient
NeoBeanNNeoBean / ❓-help
2y ago
createTRPCProxyClient Auth Server-side (t3 stack middleware)
Answer OverflowAAnswer Overflow / ❓-help
3y ago
server-side helpers doesnt work with `Hydrate` and `QueryClient`
pandakasPpandakas / ❓-help
3y ago
Server side headers are not applied
hachoterHhachoter / ❓-help
3y ago