Next-auth and standalone trpc

My team is using nextjs with a standalone trpc server and I'm trying to set up Next-Auth. When I try to run getServerSession on the request in order to add it to my trpc context I'm just receiving null, and I also have a type error coming up:
Argument of type '[IncomingMessage, ServerResponse<IncomingMessage>, AuthOptions]' is not assignable to parameter of type 'GetServerSessionParams<AuthOptions>'.
Type '[IncomingMessage, ServerResponse<IncomingMessage>, AuthOptions]' is not assignable to type '[IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }, ServerResponse<IncomingMessage>, AuthOptions]'.
Type at position 0 in source is not compatible with type at position 0 in target.
Type 'IncomingMessage' is not assignable to type 'IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }'.
Property 'cookies' is missing in type 'IncomingMessage' but required in type '{ cookies: Partial<{ [key: string]: string; }>; }'.ts(2345)
Argument of type '[IncomingMessage, ServerResponse<IncomingMessage>, AuthOptions]' is not assignable to parameter of type 'GetServerSessionParams<AuthOptions>'.
Type '[IncomingMessage, ServerResponse<IncomingMessage>, AuthOptions]' is not assignable to type '[IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }, ServerResponse<IncomingMessage>, AuthOptions]'.
Type at position 0 in source is not compatible with type at position 0 in target.
Type 'IncomingMessage' is not assignable to type 'IncomingMessage & { cookies: Partial<{ [key: string]: string; }>; }'.
Property 'cookies' is missing in type 'IncomingMessage' but required in type '{ cookies: Partial<{ [key: string]: string; }>; }'.ts(2345)
Is it even possible to run next-auth in the standalone server or do I need at least express to parse the request properly? I tried parsing out the cookie and then passing a restructured request into the getServerSession function, but that didn't work.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server