Can you access the original requesting user within trigger function?

Is there anyway access what user sent the initial request inside a trigger function? I would like my trigger logic to do different things based on the user that sent the request.

There does not appear to be any reference to the user inside the event or ctx so I assume the answer is no at the moment.

1 Like

Hi!
Yes, the trigger doesn’t have any information about the user. It’s a well-known issue and we will improve it in the feature.

For now you could retrieve information about user with next code

    const query = `{
      user {
        id
        email
      }
    }`;
    const user = await ctx.api.gqlRequest(query);
1 Like