It seems that getRoles() function stopped working from backend. It returns "Not Found: the requested item no longer exists." It was working several days ago. I tried on two websites and both had the same issue. However, getRoles() function at frondend still works.
Below is my backend code if it helps. Nothing fancy though.
// Filename: backend/aModule.jsw (web modules need to have a .jsw extension)
import wixUsersBackend from 'wix-users-backend';
export async function getUserRoles() {
try {
let user = wixUsersBackend.currentUser;
if (!user.loggedIn) throw new Error("user not logged in");
const roles = await user.getRoles();
return roles;
} catch ({ message }) {
return {error: message};
}
}
Thanks, Sam. I've sent this to QA to investigate since it's been reported here a few times.