question

glen avatar image
glen asked

What could cloudscriptapirequesterror indicate?

I've had a few cloudscriptapirequesterror errors show up in my dashboard. I haven't been able to find any information online regarding what causes this specific error to be called, and the dashboard error reporting is extremely bare bones so I'm left scratching my head as to what this may indicate.

So, specifically, what causes this to be called? Or is it more of a generic error?

CloudScript
10 |1200

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

1 Answer

·
JayZuo avatar image
JayZuo answered

CloudScriptAPIRequestError is one of ScriptExecutionError which indicates "The script called a PlayFab API, which returned an error.".

From the Errors report, you can find related error information by hovering over it like

Then you can know this error is occurred in getothersinv function and it is occurred because in this function, you called a PlayFab API and this API call returned an error. You might add try/catch in this function to handle the error like in this asnwer.

And if you've generated PlayStream event for this function. You can try to find failed event and check the raw JSON of the event. The content might like the following, in the content you can find more details about the error.

"CloudScriptExecutionResult": {
    "FunctionName": "GetOthersInv",
    "Revision": 4,
    "FunctionResult": null,
    "FunctionResultTooLarge": null,
    "Logs": [
        {
            "Level": "Error",
            "Message": "PlayFab API request error",
            "Data": {
                "api": "/Server/GetUserInventory",
                "request": {
                    "PlayFabId": "fake"
                },
                "result": null,
                "apiError": {
                    "code": 400,
                    "status": "BadRequest",
                    "error": "InvalidParams",
                    "errorCode": 1000,
                    "errorMessage": "Invalid input parameters",
                    "errorHash": null,
                    "errorDetails": {
                        "PlayFabId": [
                            "must be a hex-encoded number"
                        ]
                    }
                }
            }
        }
    ],
    "LogsTooLarge": null,
    "ExecutionTimeSeconds": 0.015547799999999998,
    "ProcessorTimeSeconds": 0,
    "MemoryConsumedBytes": 58408,
    "APIRequestsIssued": 1,
    "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 handlers.GetOthersInv (E4EB-main.js:295:28)"
    }
},

1 comment
10 |1200

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

glen avatar image glen commented ·

Wow I had no idea you could get that information with playstream events. That's amazing, thanks! This should really help debug the issue.

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.