Has anyone used getSession() with tRPC callers?
I’m curious if anyone has used callers with the server-side validation. Because callers seem to exist outside of the global Next.js request scope, passing headers into getSession() doesn’t seem to be possible.
Id like to use all of my data access functions on the server through my tRPC procedures, but my context which contains session info calls headers() outside of the request scope.
Any experience/ideas?
13 Replies
GitHub
t3-app-better-auth/src/server/api/trpc.ts at main · Bekacru/t3-app-...
Contribute to Bekacru/t3-app-better-auth development by creating an account on GitHub.
Is it just me or is the
session
from auth.api.getSession()
untyped?it's typed
I think I'm missing something as I have the same code as the example

could you share your tsconfig?
your tsconfig looks fine. can you send me your auth config?
In case you're using a monorepo, make sure all ts configs have
strict: true
set. If not and if you can provide a reproduction of the issue, I'd be happy to take a look.No worries, I just manually typed it for now just to unblock myself
Implemented from your docs today. Very helpful.
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
clerk still uses
headers
. as far as I'm aware auth
is a server side function. It just since clerk provides nextjs only sdk it doesn't require you to pass the headers, it can call it itself.