I just hit a similar/same issue.
Following the Docs here implies that I should be able to find a user
object on the context.clientContext
when a logged-in user accesses a Netlify Function.
However this:
exports.handler = async function (event, context) {
const { identity, user } = context.clientContext;
return {
statusCode: 200,
body: JSON.stringify({ message: `Hello ${ user }` })
};
}
… returns
{ message:
Hello undefined }
I have confirmed that the user is logged in and as @kristoferlund says there is user data available in the event
payload.
Am I missing something about the way this works?