question

seb avatar image
seb asked

UnlockContainerInstance returns InternalServerError with no info

Hello @Brendan hope you well,

I've been trying to fix an issue for a week. After many tries I was able to identify part of the problem. It is in the UnlockContainerInstance function.

Id : 98CD

I've created a function to replicate it: TestChestOperational I run it from the web in the player cloud script section with this argument:

PlayfabId: 543BF51ED982BD1E
{
  "chestType": "HeroChest8"
}



I got this response:

{    "FunctionResult": null,
"Logs": [
{
"Level": "Debug",
"Message": "itemId 55B1CC6508F71D83",
"Data": null
},
{
"Level": "Error",
"Message": "PlayFab API request failure",
"Data": [
[
[]
],
[
[
[
[]
],
[
[]
],
[
[]
]
]
],
[
[]
]
]
}
],
"ExecutionTimeSeconds": 4.4655336,
"MemoryConsumedBytes": 0,
"APIRequestsIssued": 15,
"HttpRequestsIssued": 0,
"Error": {
"Error": "InternalServerError",
"Message": "InternalServerError",
"StackTrace": "Error\n at Object.server_request (Script:161:24)\n at Object.server.UnlockContainerInstance (Script:612:80)\n at OpenChest (98CD-PlayFabCloudScript.js:1699:25)\n at DoOpenNowChest (98CD-PlayFabCloudScript.js:1654:12)\n at handlers.TestChestOperational (98CD-PlayFabCloudScript.js:1553:25)\n at Object.invokeFunction (Script:116:33)"
}
}

As I read in other posts, this is related to the Drop Table, I verified it and even recreated it and it's seems all the items are ok.

The test can be used only once due to the logic because it will set some values in player title data

Hope you can help us with this as always!

Thanks

10 |1200

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

Citrus Yan avatar image
Citrus Yan answered

Hi @seb, just got the following feedback from the team:

Giant inventory operations in the legacy commerce service are well known to take time - and the time it takes will grow as the player's inventory grows. So we cannot recommend that you try doing this in Cloud Script. You should either move this to Azure Functions or redesign to have the client make the call to unlock the container.

10 |1200

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

Citrus Yan avatar image
Citrus Yan answered

Hi @seb,

I looked into your title’s event history and found an event (EventId: 2dd24035a95e472a9f15a6140cc904fd) that may correspond to the response you posted. Based on the following log in the event data, looks like the “InternalServerError” error in your response has something to do with the “Timeout” error (execution time reached to 4.4655336 seconds when this error happened, while default time limit is 4.50 seconds):

{
        "Message": "PlayFab API request failure",
        "Level": "Error",
        "Data": {
          "error": "Timeout",
          "request": {
            "ContainerItemInstanceId": "55B1CC6508F71D83",
            "KeyItemInstanceId": "92936F47CB98B2E8",
            "PlayFabId": "543BF51ED982BD1E"
          },
          "api": "/Server/UnlockContainerInstance"
        }
      }
}

As I see it, the issue that UnlockContainerInstance returns InternalServerError with no info is probably caused by the “Timeout” error. Could you please set up a test that only calls the server.UnlockContainerInstance and see whether the “InternalServerError” still occurs?

If the "InternalServerError" is indeed caused by the "Timeout" error, you may need to consider reducing execution time by optimizing the CloudScript code or raising the execution time limit.

10 |1200

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

seb avatar image
seb answered

Hi @Citrus Yan thanks for your response, however still happening.

I've set up the test only calling the UnlockContainerInstance. And the I got the time out in the UnlockContainerInstance response.

{
    "TaskInstanceId": "E3D910C7874C0B7E-3",
    "TaskIdentifier": {
        "Name": "TestChestOpen",
        "Id": "E3D910C7874C0B7E"
    },
    "StartedAt": "2019-11-18T10:49:59.1966973",
    "CompletedAt": "2019-11-18T10:50:03.3217251",
    "Status": "Succeeded",
    "PercentComplete": null,
    "EstimatedSecondsRemaining": null,
    "ScheduledByUserId": "F40FBEF1693D1843",
    "Result": {
        "FunctionName": "TestOpenChest",
        "Revision": 585,
        "FunctionResult": null,
        "FunctionResultTooLarge": null,
        "Logs": [
            {
                "Level": "Error",
                "Message": "PlayFab API request failure",
                "Data": {
                    "api": "/Server/UnlockContainerInstance",
                    "request": {
                        "PlayFabId": "543BF51ED982BD1E",
                        "ContainerItemInstanceId": "646EA141E1483A",
                        "KeyItemInstanceId": "FD259536D263168F"
                    },
                    "error": "Timeout"
                }
            }
        ],
        "LogsTooLarge": null,
        "ExecutionTimeSeconds": 3.9941402999999998,
        "ProcessorTimeSeconds": 0,
        "MemoryConsumedBytes": 49464,
        "APIRequestsIssued": 1,
        "HttpRequestsIssued": 0,
        "Error": {
            "Error": "InternalServerError",
            "Message": "InternalServerError",
            "StackTrace": "Error\n    at Object.server_request (Script:161:24)\n    at Object.server.UnlockContainerInstance (Script:612:80)\n    at handlers.TestOpenChest (98CD-PlayFabCloudScript.js:1738:25)\n    at Object.invokeFunction (Script:116:33)"
        }
    }
}

As there is any other code. Does it mean that there is a limit in the amount of items a container can have?


Also I checked the settings and the value for execute time limit I have is 10 seconds (Enterprise)

Thanks,

6 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.

Citrus Yan avatar image Citrus Yan commented ·

Hi @seb, this looks like something that needs investigation, I've already reported this issue to the engineering team for more investigation, any updates will keep you informed.

And, as far as I am aware, there is no such limit on the number of items a container can have, so it's not likely that this issue is caused by that.

1 Like 1 ·
seb avatar image seb Citrus Yan commented ·

Thanks, appreciated. I'll looking forward

0 Likes 0 ·
seb avatar image seb commented ·

Hi @Citrus Yan any news about this?. We are close the deadline, Thanks.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan seb commented ·

Based on the initial analysis, doing 100 items in a drop table full of 16 different type of stackable items took around 4 seconds, which is similar to your case, however, the problem is that the default timeout for a single Playfab API call for Cloudscript is 4 seconds, so this might be the reason why you hit the timeout issue. The engineering team is now investigating why this API is taking you guys 4 seconds. In the meantime, you might want to consider splitting the HeroChest8 into smaller pieces to avoid the timeout issue.

By the way, can you share with us the deadline for your project so that I can share this information with the engineering team?

0 Likes 0 ·
seb avatar image seb Citrus Yan commented ·

Thanks for the info @Citrus Yan the deadline this Dec 10th

0 Likes 0 ·
Show more comments
seb avatar image
seb answered

Hi @Citrus Yan any news about this?

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.