Context is not being passed correctly
I will include my setup at the end. My problem is that I am using nextauth with database sessions and passing the session as context into the procedures; however, everything that I have added myself isn't being included in the context for some reason (user.id and user.role)
This is my session type I declared,
This is the session callback I am using.
The console.log is just to see what is happening where (I will include it at the end)
I will include the rest of the information in the next message as I reached the character limit.
Codex•40d ago
Finally this is what is creating the session.
What is happening is that when the front end calls the session I properly get the role inside session.user.role.
Moving from the front end to the actual API calls, the first time it creates the session in the middleware it is going through my session callback, and the session when logged DOES come with role and userId,
However once it is returned it somehow loses those two values, and the context is set without those two.
Any help is much appreciated thanks in advance.
Setup:
T3: Nextauth, Nextjs pages router, trpc, typescript and prisma.
Node version: 18.18.1
4.8KMembers
View on DiscordMore Posts
How to get the Request Body data of QStashHello everyone. I'm currently working on a client project that involves using trpc with Next.js. We'Preventing uncaught error propagation from server to clientHello guys, is there any way to create default error handler?
I want to avoid leaking internal inforThrowing something other than `Unexpected token '<', "<!DOCTYPE "... is not valid JSON`I'm trying to do custom error handling but whatever I throw just ends up being `Unexpected token '<'Create client that is used in every request, without re-creating clientHi all,
Consider the following
```
export const createContextInner = async ({
req,
res,
}: {
Using TRPC Server Caller in client side.What's up TRPCer.
so i'm currently working in vanilla react app with seperate backend in .NET, in pAnyone has successfully setup a websockets subscription with an input ?Hi guys, here is my environment:
*** node v20.11.1
* yarn@4.1.0
* trpc 11.0.0-next-beta.294
* next 1