question

Kvaba Interactive avatar image
Kvaba Interactive asked

GetUserInternalData returns Error: Maximum response size reached

Hello,

I made a mess and I can't seem to find a way to fix it. Please help :)

  1. I created a function in CloudScript (legacy) that would occasionally backup some UserReadOnlyData to UserInternalData.

  2. I gave these backups dynamic names with pattern backup_timestamp (as we'll see this proved to be a very bad idea)

  3. The game experienced unexpectedly high activity in this particular area, which resulted in a lot of internalData backups all with dynamic keys

  4. We noticed this when PlayFab's admin panel > player > Title Data wouldn't load anymore

  5. We rewrote the backup script so there will be no more uncontrolled Internal Data creation

  6. But ... players who had reached this limit are no longer available for browse via PlayFab admin panel, nor via API calls

How I planned to fix the issue:

  1. Write a method that will get all playerInternalData

  2. Loop through the keys

  3. Filter keys that are named using the pattern: keysToDelete = Object.keys(result.Data)).filter( key => key.includes("backup_167") )

  4. Call UpdateUserInternalData with KeysToRemove: keysToDelete

But... the size of GetUserInternalData is too big. When I call Admin/GetUserInternalData via Postman I get Error: Maximum response size reached

When I call Server/ExecuteCloudScript with FunctionName: myFunction I get "error": "Timeout" with: "ExecutionTimeSeconds": 4.0024451, "ProcessorTimeSeconds": 0.001453, "MemoryConsumedBytes": 7624,

I am open to ideas how to clear the unwanted UserInternalData keys.

apisCloudScriptlimits
10 |1200

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

Xiao Zha avatar image
Xiao Zha answered

>> But... the size of GetUserInternalData is too big. When I call Admin/GetUserInternalData via Postman I get Error: Maximum response size reached.

This is a Postman error. You can change the Max response size(which default is 50MB) in Settings to the size you want. Or set it to 0 in case you want to download the response of any size.

>> When I call Server/ExecuteCloudScript with FunctionName: myFunction I get "error": "Timeout" with: "ExecutionTimeSeconds": 4.0024451, "ProcessorTimeSeconds": 0.001453, "MemoryConsumedBytes": 7624

Here is my CouldScript Code, which can successfully delete user internal data. However, there is a 10 keys limit in Player data updates per request which means you cannot delete all keys with CouldScript at a time. As for the Title Data page cannot load, could you please provide us your TitleId and the problematic player account.

 handlers.Test = function (args, context) {
          var playerData = server.GetUserInternalData
              ({
                  PlayFabId: currentPlayerId,
              });
         var DeleteObject=(Object.keys(playerData.Data)).filter( key => key.includes("test_") )
         var result=server.UpdateUserInternalData({PlayFabId: currentPlayerId, KeysToRemove:DeleteObject});        
          return result;         
  };
10 |1200

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

Kvaba Interactive avatar image
Kvaba Interactive answered

Thanks for the tips!

Further investigation into the issue proved we had a bug that kept creating new userInternalData keys a lot more than what it was supposed to. I had my Postman set to a 50mb limit, but it seems the userInternalData is 50.81mb. Further increase in Postman limit leads to a crash 30 seconds after sending the request.

Here's the title info: TitleId: CA59B PlayFabId: 20D9E81F14AD8BE0

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.

Xiao Zha avatar image Xiao Zha commented ·

You can set the Postman limit to 0 to get the response of any size, then you can delete the unwanted keys with Postman manually.

1 Like 1 ·
Kvaba Interactive avatar image
Kvaba Interactive answered

A few clarifications if anyone ever stumbles upon a similar issue:

  1. We had a bug that got into production and started generating userInternalData key-value pairs with dynamic keys

  2. Once the userInternalData grew too big it was no longer possible for a CloudScript function to call Admin/GetUserInternalData , loop through the keys and remove the unwanted ones, as the payload was too big and the max execution time killed it

  3. Trying to call https://{ {TitleId}}.playfabapi.com/Admin/GetUserInternalData via Postman had similar results - no matter what limits I entered in the app's settings, it crashed

  4. Calling it via cURL and saving the result to a file did the trick

  5. It turned out we had piled up over 6000 kv pairs for an affected user profile

  6. Now I'll need to write a script to go through the file, extract the desired keys and later call Admin/UpdateUserInternalData with KeysToRemove: [10 keys]

Thanks to @Xiao Zha for the tips - it greatly helped me find a solution.

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.