Numbers, integers... same thing, right? :)


So it took me a while to figure out why the PlayFab API did not accept my leaderboard update requests. If you play the jam version of the game there is a very good chance you'll see this error message in your JavaScript console if you try to submit your time to the leaderboards:

Error:Invalid input parameters
Statistics[0].StatisticName: The StatisticName field is required.

It drove me up the wall for better part of an hour, but finally googling the problem brought results:
https://community.playfab.com/answers/13210/view.html

TL;DR: the problem is, that even though the official API docs say StatisticUpdate objects' Value properties should be "number" type (and not integer), indeed the problem is that I'm trying to submit split second values like 13.37. Unfortunately the error message above is not very helpful to say the least, in fact I was sure that there was a typo somewhere and the request body was malformed... except that thanks to PlayFab's very detailed error object, I could see my original request object was in fact not malformed, and contained the required StatisticName and Value fields.

Hopefully PlayFab will either fix their docs so it says "integer" instead of "number" at the aforementioned place (and maybe give the right error message if the problem is a non-integer number)..., or indeed accept non-integer numbers :)

Files

AzureLuxChainReaction.zip Play in browser
Sep 13, 2021

Get Chain? Reaction!

Leave a comment

Log in with itch.io to leave a comment.