I have apollo code that I’ve been using for a few months - suddenly I’m not getting a user returned. I can retrieve my list of accounts, so I know the jwt is working. Did the encapsulation of the user change, or did the request change? I am not seeing it in the response that used to contain it.
if it helps, my apollo server implementation is below. user is always null.
const server = new ApolloServer({
gateway,
subscriptions: false,
context: ({ req }) => {
console.log(req)
const user = req.user || null;
console.log(req.user)
return { user };
}
})
Hm, it looks like the user is being set to the request headers, but the ApolloServer is expecting it as a property of the request. Maybe if the ApolloServer used req.headers.user it would not be null. It is hard to determine without the full context, though.