question

max avatar image
max asked

Cocos2d-x Demo Project - PlayFab Test - Cloud Script Null Response

I'm currently trying to run the PlayFabApiTest from the the Cocos2d-x examples.

I've set up up my titleID and also added a valid userName / password / email / characterName in the respective fields of the test.

I'm currently receiving the error: "Failed to submit Cloud Script: Request Timeout or null response"

It happens when the test calls the "SaveTestData" Cloud Script. Previously I received the error of this Cloud Script being non-existent, hence I created it:

// added for the play fab test
handlers.SaveTestData = function(args, context)
{
    log.debug("Save Test Data");

    var message = "YAY " + currentPlayerId;
    return {messageValue : message};
}

The response I get in my game's code is an empty string. Did I maybe make a mistake with the Script I created?

How could I fix this issue?

CloudScript
10 |1200

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

1807605288 avatar image
1807605288 answered

Most of the PlayFab example projects and api-tests require a specific set of CloudScript functions from our SdkGenerator:

https://github.com/PlayFab/SDKGenerator/blob/master/JenkinsConsoleUtility/jcuCloudScript.js

You cannot simply implement stubs for those functions, sorry. Copy the functions from the link above, and append them into your uploaded CloudScript file. This isn't documented well, sorry. We're still building that system, so we haven't made a good public documentation pass yet.

Separately, by itself, I don't think this should be the cause of the "Request Timeout or null response" part of your error.

This implies a connectivity error, or some other failure to contact our server.

If you continue to have issues, please post again with information matching my bulleted questions.

10 |1200

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

max avatar image
max answered

Thanks for the info, first of all: I got it working. I copied in the CloudScripts that you linked.

I'm running on iOS and Android, using Cocos2d-x

But as you suggested there was another problem actually and I believe it was a bug in the tests.

At the end of the ClassSetup, this check is being made to determine if the setup was successful. The problem is that the check forces the file input stream titleInput AND the single input fields to be setup, but I was not using titleInput, hence it returned always false.

// Verify all the inputs won't cause crashes in the tests
return static_cast<bool>(titleInput)
   && return !playFabSettings->titleId.empty()      
   && !userName.empty()
   && !userEmail.empty()                  
   && !userPassword.empty()      
   && !characterName.empty();

After changing it to this, the tests start to run:

// Verify all the inputs won't cause crashes in the tests
return static_cast<bool>(titleInput)
   || (return !playFabSettings->titleId.empty()      
   && !userName.empty()
   && !userEmail.empty()                  
   && !userPassword.empty()      
   && !characterName.empty());

Then several tests crash (probably due to me not having a specific setting enabled in my game). I just disabled these and was then able to run the most basic tests successfully on both iOS and Android.

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.

1807605288 avatar image 1807605288 ♦ commented ·

You're right, the titleInput is not required if you provide the inputs directly.
I have fixed that, and in the next build, titleInput will be removed entirely from that check.

And, yes, you're right. The tests require a Game-Manager permission that lets you set statistics from the client.
Any title that wants to prevent cheating should not have that permission set, but the api-tests are just verifying funtionality.

I'm glad we got you working, take care.

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.