t
tRPC
t
tRPC
createContext() not working in SSR
Original message was deleted
tRPC
Join
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,111
Members
View on Discord
A
Alex / KATT ๐ฑ
โข
12/22/22, 11:07 PM
you likely want to have an
"inner
" context that you can call from anywhere
A
Alex / KATT ๐ฑ
โข
12/22/22, 11:07 PM
we have some docs in the works for this
https://www-git-fork-bennettdams-bennettdams-context-docs-trpc.vercel.app/docs/context#example-for-inner--outer-context
Context | tRPC
Your context holds data that all of your tRPC procedures will have access to
, and is a great place to put things like database connections or authentication information
.
A
Alex / KATT ๐ฑ
โข
12/22/22, 11:07 PM
and our official example uses it too
:
https://github.com/trpc/examples-next-prisma-starter/blob/main/src/server/context.ts
GitHub
examples-next-prisma-starter/context.ts at main ยท trpc/examples-nex...
tRPC starter repo with E2E
-testing
. Contribute to trpc
/examples
-next
-prisma
-starter development by creating an account on GitHub
.
T
TkDodo ๐ฎ
โข
12/23/22, 5:58 AM
Hmm I do
:
const ssg = await createSSGHelpers(ctx.req, ctx.res)
const ssg = await createSSGHelpers(ctx.req, ctx.res)
where
ctx
ctx
is what we get passed into getServerSideProps and it works fine
.
.
.
createContext() not working in SSR - tRPC