Hi -
It looks like the Node SDK doesn't handle long utf8 characters correctly when it's posting to the server. The https module ends up encoding into utf8, but the Content-Length was set using the string's length. When including emoji in the request (because who doesn't want an airplane in their username!), the content length will be too short, and the server will report that the string was unterminated. To replicate, using the Admin SDK. You'll need to put some emoji characters in the DisplayName -- the forum software was giving me an error when attempting to create a post with the real request.
PlayFabAdmin.UpdateUserTitleDisplayName({ PlayFabId: "85A8979D97D576B8", DisplayName: "emoji-characters-here"})
You'll get the following error:
{"code":400,"status":"BadRequest","error":"InvalidRequest","errorCode":1071,"errorMessage":"Invalid JSON in request","errorHash":"d863310ed6e31a73160eaa8939e9c3c9","errorDetails":{"ValidationError":["Unterminated string passed in. (62): {\"PlayFabId\":\"85A8979D97D576B8\",\"DisplayName\":\"dbeets"]}}
The correction is very easy: in the MakeRequest function, change the stringify from
var requestBody = JSON.stringify(request);
to
var requestBody = Buffer.from(JSON.stringify(request), 'utf8');
Then everything will work correctly. I created a pull request on GitHub showing this change: https://github.com/PlayFab/NodeSDK/pull/88.
Cheers
-Courtland