Users-permissions queries returning an empty array

I’m trying to get access to the roles of the users in a strapi system but no matter what I try it seems to return an empty array.

At the most basic, I’m sending a request using:

const users = await strapi.entityService.findMany(
  'plugin::users-permissions.user', 
  {
    populate: ["*"]
  }
)

However, this just returns []. I’ve tried with many different iterations of the above and I’ve also tried using db queries, similar to the below:

const usersDB = await strapi.db.query('plugin::users-permissions.user').findMany(
  {
    populate: ["*"]
  }
)

Unfortunately, this also returns an empty array. Is there something I’m missing here?

This topic has been created from a Discord post (1264976718440173706) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

As a bit of extra info, even sending a request to /api/users results in the same empty array.

Another update, it appears I can access this information via /admin/users but this is obviously not ideal as it means I have to get a Bearer token before using it (I’m currently using an api token)

This req works fine from my app if i grant access to “role” field in U&P

/api/users?populate=role

Not sure how to mark this as resolved but the root of the issue my issue specially was actually that you can’t access the CMS admin users using the normal api, i.e. you can’t use an API token

The users that, the endpoint you show return are the users that are added in the actual content types

For future reference, if you wanted to get the CMS admins, you need to use /admin/users

With a valid jwt token