question

Jacky Chou avatar image
Jacky Chou asked

Putting item with quantity of 500 into a container cause error when UnlockContainerInstance

Hello,

I have set up a container and use UnlockContainerInstance to unlock its instance.

UnlockContainerInstance is fine for this container with just some currency:

BUT UnlockContainerInstance causes error after adding an item of 500 quantity:

This is the log of the error.

"Error: {\"cloudScriptErrorCode\":\"InternalServerError\",\"stack\":\"Error\\n at Object.server_request (Script:162:24)\\n at Object.server.UnlockContainerInstance (Script:618:80)\\n at consumeIapProductItem (B3B88-main.js:1414:52)\\n at handlers.IapProductPurchased_Entity (B3B88-main.js:1317:29)\\n at Object.invokeFunction (Script:117:33)\"

Anyone has similar issue? Please help.

Thank you very much.

i7rq3.png (84.8 KiB)
3 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 ·

According to the description, you use the CloudScript function to unlock the container, is it right? If so, could you please provide the code snippet relevant to the main logic for our reference?

0 Likes 0 ·
Jacky Chou avatar image Jacky Chou Sarah Zhang commented ·

Hi Sarah, yes I am using CloudScript function.

Here is the code:

 var unlockContainerResult = server.UnlockContainerInstance(
                    {
                        PlayFabId: currentPlayerId,
                        ContainerItemInstanceId: productItem.ItemInstanceId,
                    });


0 Likes 0 ·
Jacky Chou avatar image Jacky Chou Sarah Zhang commented ·

Here is the more log: looks like a timeout problem.

"Logs": [ { "Level": "Error", "Message": "PlayFab API request failure", "Data": { "api": "/Server/UnlockContainerInstance", "request": { "PlayFabId": "208BE6ABE0C2F21B", "ContainerItemInstanceId": "FE2491032830B684" }, "error": "Timeout" } },

"ExecutionTimeSeconds": 4.1642519, "ProcessorTimeSeconds": 0.0044349, "MemoryConsumedBytes": 52768, "APIRequestsIssued": 4, "HttpRequestsIssued": 0

0 Likes 0 ·
JayZuo avatar image
JayZuo answered

CloudScript limits the execution time of CloudScript API calls to 4 seconds. If the execution time exceeds 4 seconds, an InternalServerError is raised. For more details, please see CloudScript timeout error.

Attempting to add a large number of items can cause delays to completion of the process. Unlock 500 items will definitely cause the issue. For more info, please see https://community.playfab.com/comments/15527/view.html.

10 |1200

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

Jacky Chou avatar image
Jacky Chou answered
Here is the code.



 var unlockContainerResult = server.UnlockContainerInstance(
                    {
                        PlayFabId: currentPlayerId,
                        ContainerItemInstanceId: productItem.ItemInstanceId,
                    });

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.

Sarah Zhang avatar image Sarah Zhang commented ·

[Edited] @Jacky Chou CloudScript limits the execution time of CloudScript API calls to 4 seconds. If the execution time exceeds 4 seconds, an InternalServerError is raised. For more details, please see CloudScript timeout error.

We tested calling the Client API UnlockContainerInstance to unlock the container that contains 500 non-stackable items, it can work fine, and it will take about 11 seconds. It exceeded the limit -- 4 seconds.

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.