I guess this user has a role (or more) that is not included in the roleValues array.
so to solve that add after
let roles = r.map(e => e.name);
The following line:
roles = roles.filter(e => roleValues.some(i => i.role === e));
I guess this user has a role (or more) that is not included in the roleValues array.
so to solve that add after
let roles = r.map(e => e.name);
The following line:
roles = roles.filter(e => roleValues.some(i => i.role === e));