question

Toni Palm avatar image
Toni Palm asked

Returning lots of data from Azure Function

Testing the Azure Functions I did the following:

  • Created an AF that calls PlayFab.PlayFabServerAPI.GetPlayerCombinedInfoAsync
  • Converted the result object to JSON string
  • Returned that string as result of the AF
  • Tested calling this from Game Manager, from a Player

The AF runs OK, but the Game Manager says "there are errors on the page". The amount of returned data is somewhat big as it includes the player inventory, account info, titledata and whatnot. If I return just a short string, everything works fine.

So is there a limit in the amount of data that can be returned from an Azure Function, will the client choke on it, or is this a limitation in the Game Manager?

CloudScriptgame manager
10 |1200

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

marcowilliamspf avatar image
marcowilliamspf answered

My suggestion to avoid this issues:


1> Turn off writeToPlayStream for all AzureFunction Events.
2> If you need a PlayStream output, manually write to PlayStream at the end of the function.
3> If you write to PlayStream manually, be sure to put it behind some enable/disable flag so you can turn it off through configuration.That should avoid the issue as the return result from the function will be smaller, but you still can write what you want to PlayStream.
10 |1200

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

Toni Palm avatar image
Toni Palm answered

I can confirm this is a problem also when calling from client

10 |1200

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

Seth Du avatar image
Seth Du answered

It is possible that there is size limitation on Game Manager webpage, but we also notice that if you set GeneratePlayStreamEvent as true in the request, the argument size and return value size is strictly limited. Please try to set it as false and test again.

I have done some tests to try to return a string with 10000 characters (with GeneratePlayStreamEvent as true), failed callback will be returned. However, 5000 characters work fine as charm. Even though the test result, Azure function is more than enough to handle a GetPlayerCombinedInfo result in the normal circumstances. Meanwhile, after GeneratePlayStreamEvent is set as false, this issue doesn’t occur.

We will recommend you to use RESTful testing tools like Postman to monitor the response. Please see: https://docs.microsoft.com/en-us/gaming/playfab/sdks/postman/. Please feel free to tell us if you still have this issue on Postman.

In terms of the PlayStream issue, we will submit a report to the corresponding team.

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

Toni Palm avatar image Toni Palm commented ·

Thanks! Setting the GeneratePlayStreamEvent to false did the trick, the call now works both from Game Manager and from client

1 Like 1 ·
Toni Palm avatar image Toni Palm commented ·

Actually I'm running into this/similar problem again, this time calling from the client, and this time also with a clear message:

<<< ExecuteCloudScript FAIL: CloudScriptAzureFunctionsReturnSizeExceeded:Load2:/CloudScript/ExecuteFunction: Cloud script function Load2 returned value that was too large<br>

So I guess there's some limit somewhere. GeneratePlayStreamEvent is set to false in this one. This is also returning lots of other data, not just the PlayerCombinedInfo. I have similar function in CloudScript returning similar amount of data, and not running into this limit.

So what's the max size of the return message from Azure Functions? And is it different from CloudScript return message size?

0 Likes 0 ·
robert avatar image
robert answered

We also have the same issue...

Calling a method with ExecuteCloudScript and returning a big JSON works flawlessly.
Calling a method with ExecuteFunction and returning the SAME BIG JSON, we receive the CloudScriptAzureFunctionsReturnSizeExceeded receive.

As Azure Functions are meant to be a replacement for cloudscript it will be very handy and even indispensable being able to return the same data objects to the client. (GeneratePlayStreamEvent is set to false)

Any advice? 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.

esenkleiter avatar image
esenkleiter answered

Same problem as Robert. Any solutions so far? We have 133kb game config the player needs at the first start of the game. A solution to split the request is ... you can guess. Can someone tell us the exact limit? Is it possible to get a higher limit? Thanks in advance.

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.

esenkleiter avatar image esenkleiter commented ·

by the way setting GeneratePlayStreamEvent = false does not help

0 Likes 0 ·
Jan Vacek avatar image
Jan Vacek answered

Please any suggestions? GeneratePlayStreamEvent is false, but still getting this error

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.