I have a function I made in Cloud Script that I've been using for a few months and it was working up until a couple of days ago, I didn't change it and I don't understand what happened.
I'm using the GetPlayersInSegment function and its always returning 0, I have checked the SegmentId and its the correct one, the segment has about 900 entries.
This is the code:
handlers.getLeaderboardEntriesAmountById = function (args, context) {
var finalSegmentId = args.SegmentId
var request = {
"SegmentId": finalSegmentId,
"MaxBatchSize": 1,
"SecondsToLive": 1
};
var playersInSegmentResult = server.GetPlayersInSegment(request);
playersAmount = JSON.parse(JSON.stringify(playersInSegmentResult)).ProfilesInSegment
result = {
"playersAmount": parseInt(playersAmount)
}
return result
}