Set session.user
to be equal to req.user
#3019
Unanswered
deadcoder0904
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a
ApolloServer
that hasuser
value in it'scontext
field:The
user
field is equal toreq.user
but currently it'sundefined
.I want to tell
next-auth
to attach theuser
that we get fromsession.data.user
toreq.user
so I can query from my http://localhost:3000/api route:Currently, this returns
null
but I want it to return currentuser
object.Is there any way to do that?
I tried doing the following:
But it doesn't work & gives me
[next-auth][error][CLIENT_FETCH_ERROR]
&ENFILE
error. It keeps reloading the server forever.I also tried doing it without
async
like:But that didn't work either.
Reproduction on
prisma
branch → https://github.com/deadcoder0904/twitter-api-v2-3-legged-login-using-next-connect/tree/prismaTo make it work, remove the
async
& comment out the first 2 lines inside the function above.Would love to know is there a way to make this work? I searched documentation but couldn't find anything.
PS: Algolia Search lead to v3 always even if you are browsing v4 which probably leads to many v3-v4 bugs mismatch in this Discussions forum.
Beta Was this translation helpful? Give feedback.
All reactions