getAllUsers or queryUsers returns currently connected users instead of all users in the system

getAllUsers or queryUsers returns currently connected users instead of all users in the system in js sdk whereas in typescript sdk it returns all the users. I wanted to list all the users available in the console but these functions aren’t working as per my usecase. Can you please let me know if there is a function for getting all users in js sdk?

Hello, could you also please share with us your js code? and what’s your current version?

Hi, I am using the latest version using unpkg, which is 5.31.0 . Please find below my code:

const userRepo = new UserRepository();
const allUsers = userRepo.getAllUsers();
allUsers.on("dataUpdated", models =>{ models.map(model => {console.log(model.userId);})});

I also tried using the updated queryUsers function

 const liveUserCollection = UserRepository.queryUsers({
  filter: 'all',
 sortBy: 'displayName'
 }); 
 liveUserCollection.on("dataUpdated", models => { models.map(model => console.log(model.userId));}); 
});

Both of these functions are returning currently connected users instead of all users.

Hello, could you pls try this code below? it should return 20 users per time

const userRepo = new UserRepository();
    const liveObject = userRepo.getAllUsers(UserSortingMethod.DisplayName);
    liveObject.on("dataUpdated", (user) => {
      console.log(user);
    });

Hello, I just tried this code. It is returning me just those users which connected to server today, not all users. Can you please check this on your end for js sdk just to make sure that this is not a bug?

Hi, we already checked and it works fine for us. The users you received should be all users but you will have to loop it.

const userRepo = new UserRepository();
    const liveObject = userRepo.getAllUsers(UserSortingMethod.firstCreated);
    liveObject.on("dataUpdated", (user) => {
      console.log(user);
    });

It will be sorted by first created user

Hello, Yeah I understand that I will have to loop through all the users that I receive as it is an array of objects but after running this code, it is not returning me all the users in the system. I verified it through length property of the result as well.
Is it like on your end you tested with all the users which were connected to server through some or the other way, today itself? In that case it is returning all users as all of them were connected. It is not returning those users which don’t connect on the same day.

Hello, we have received all users, please see the sample response below:

If you would like us to check further on your network, please provide us your apikey and serverkey to our support email: support.asc@amity.co