why is context data undefined?
Unanswered
Arthur posted this in #help-forum
ArthurOP
I fetched data from inside a 'use server' but the data is
undefined in context. I added a log in the fetchUser function and received data. I returned that data to the AuthContext. In the auth context the data is undefined9 Replies
Holland Lop
where do you give data to contex?
Tonkinese
Well since you cropped out the line numbers, I'd say either change your 'User not found' error to something that's more distinguishing from internal errors... or you could just check to see if that error you're throwing is on line 180. If it's not you're likely not passing it into the write place, but if it is I'd check different cache's that might exist in the windows environment and not the linux env.
@Holland Lop where do you give data to contex?
ArthurOP
in a service file
YOu can assume that this returns the user object
Holland Lop
The error is in AuthContext line 180, you can use console.log in fetchUser function to make sure it works as expected and then continue the flow of code to find from where user became undefined