question

Hyunng Woo You avatar image
Hyunng Woo You asked

PlayFab Cloude Script Error Object.invokeFunction (Script:116:33)

Cloude Script

handlers.TouchMoney = function (args, context) {
        var playerData = server.GetUserData({
        PlayFabId: currentPlayerId,
        Keys : ["Money"],
    });
    var message = (parseInt(playerData.Data["Money"].Value, 10) + 1);
    var keyString = "Money";
    var dataPayload = {};
    dataPayload[keyString] = message;
            server.UpdateUserData({
        PlayFabId: currentPlayerId,
        Data: dataPayload
    });
    return { 
        messageValue: message
    };
}
Debug
{
    "FunctionResult": null,
    "Logs": [
        {
            "Level": "Error",
            "Message": "PlayFab API request error",
            "Data": [
                [
                    []
                ],
                [
                    [
                        [
                            []
                        ],
                        [
                            [
                                [
                                    []
                                ]
                            ]
                        ]
                    ]
                ],
                [
                    []
                ],
                [
                    [
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ],
                        [
                            []
                        ]
                    ]
                ]
            ]
        }
    ],
    "ExecutionTimeSeconds": 0.035441299999999995,
    "MemoryConsumedBytes": 23968,
    "APIRequestsIssued": 2,
    "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:180:24)\n    at Object.server.UpdateUserData (Script:625:71)\n    at handlers.TouchMoney (9F1FF-main.js:15:20)\n    at Object.invokeFunction (Script:116:33)"
    } 

}

I made repeated TouchMoney requests.

Errors occur later after success.
Please teach me the way.

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

·
Seth Du avatar image
Seth Du answered

Where do you monitor this function result? Is it from PlayStream event?

There is high possibility that this issue is caused by limit exceeding. I have copied your codes and tried to reproduced your issue on Postman(RESTful testing tool) and instead of receiving a blank list, I get error messages about limit, after calling repeated API for few times. Please always return the error messages for debugging.

{
  "code": 200,
  "status": "OK",
  "data": {
      "FunctionName": "TouchMoney",
      "Revision": 191,
      "Logs": [
          {
              "Level": "Error",
              "Message": "PlayFab API request error",
              "Data": {
                  "api": "/Server/UpdateUserData",
                  "request": {
                      "PlayFabId": "8A364330FCD8671F",
                      "Data": {
                          "Money": 352
                      }
                  },
                  "result": null,
                  "apiError": {
                      "code": 429,
                      "status": "429",
                      "error": "DataUpdateRateExceeded",
                      "errorCode": 1287,
                      "errorMessage": "DataUpdateRateExceeded",
                      "errorHash": null,
                      "errorDetails": null
                  }
              }
          }
      ],
      "ExecutionTimeSeconds": 0.0849176,
      "ProcessorTimeSeconds": 0.0,
      "MemoryConsumedBytes": 39440,
      "APIRequestsIssued": 2,
      "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:180:24)\n    at Object.server.UpdateUserData (Script:625:71)\n    at handlers.TouchMoney (2B3F-main.js:11:20)\n    at Object.invokeFunction (Script:116:33)"
      }
  }
}



Please note that there is limit on updating player data, please see it at [Game Manager] -> [Title Settings] -> [Limits]

10 |1200

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

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.