question

Linda Shi avatar image
Linda Shi asked

GetPlayersInSegment returning CloudScriptAPIRequestError

var tradingPlayers = server.GetPlayersInSegment({ SegmentId: segmentID, MaxBatchSize: sampleAmount });

// the id was correct and the sampleAmount was 5...

Not sure if this is a known issue.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image
Sarah Zhang answered

There was a known problem that segment calls always exceed the limit even if the rate of calls is actually slow. This problem has now been resolved. Could you please check it now?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image
Sarah Zhang answered

Could you please provide the detailed error messages? And how many players in the segment? How you execute the relevant CloudScript function? Do you use the Actions to trigger the function, or you call the API ExecuteCloudScript? For clarification, there are some limitations of the processing time of the CloudScript functions. The maximum processing time for a CloudScript function called by the ExecuteCloudScript API is 10 seconds, and the maximum processing time for a CloudScript function called by an action trigger is 1 second. So, calling Server API GetPlayersinSegment in CloudScript function may cause timeout error.

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Linda Shi avatar image Linda Shi commented ·

There was 7 players in the degment, I executed this function via Cloudscript from on specific player via this url : https://developer.playfab.com/en-US/r/t/<titleID>/players/<PlayerID>/cloudscript

so it's not due to how often this is executed.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Linda Shi commented ·

Could you please provide the relevant code snippet? We can't check the CloudScript page without the TitleID.

0 Likes 0 ·
Linda Shi avatar image Linda Shi Sarah Zhang commented ·

var tradingPlayers = server.GetPlayersInSegment({ SegmentId: "EBA5606C50A907AC", MaxBatchSize: 5 });

Title id is EC55

0 Likes 0 ·
Show more comments
Linda Shi avatar image
Linda Shi answered
{
    "FunctionResult": null,
    "Logs": [
        {
            "Level": "Error",
            "Message": "PlayFab API request error",
            "Data": [
                [
                    []
                ],
                [
                    [
                        [
                            []
                        ],
                        [
                            []
                        ]
                    ]
                ],
                [
                    []
                ],
                [
                    [
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ]
                    ]
                ]
            ]
        }
    ],
    "ExecutionTimeSeconds": 1.5044211,
    "MemoryConsumedBytes": 19656,
    "APIRequestsIssued": 3,
    "HttpRequestsIssued": 0,
    "Error": {
        "Error": "CloudScriptAPIRequestError",
        "Message": "The script called a PlayFab API, which returned an error. See the Error logs for details.",
        "StackTrace": "Error\n    at Object.server_request (Script:181:24)\n    at Object.server.GetPlayersInSegment (Script:539:76)\n    at GetAllPlayersTrading_internal (EC55-main.js:1378:37)\n    at handlers.GetAllPlayersTrading (EC55-main.js:1475:12)\n    at Object.invokeFunction (Script:117:33)"
    }
}
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image Sarah Zhang commented ·

This Game Manager display issue should be fixed, could you please check it?

0 Likes 0 ·
Linda Shi avatar image Linda Shi Sarah Zhang commented ·

yes it has been fixed, thank you!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.