NeoBeanN
tRPC3y ago
7 replies
NeoBean

Forward client headers with createTRPCProxyClient & Server-Side Helpers

With createTRPCNext i had the option to tap into the context.req object nextjs passed in, but I cant achieve the same with 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() } }
}
Was this page helpful?