Roles not being sent with id token

I set up the following and looked at every post on here related to this but I am not getting roles back in my id token on my client side app after logging in:

exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://example-api.com';

  if (event.authorization) {
    api.idToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
    api.accessToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
  }

}

The action is executing but the id token doesnt get the roles

Hi @sydl

Welcome to the Auth0 community …

Does event.authorization.roles have any roles in it? Can you please console output and see what comes out for that line of code?

Thanks
Jeff