Yaser avatar image
Yaser asked

Cloud Script questions - Where are log files?


Few questions regarding Cloud Script:

(Sorry If they are answered elsewhere, but I have searched in the documentation and forums without luck, please provide me a link if they are already documented or answered)

1) When I use the function log.debug or in a cloud script, where are the messages stored? I read somewhere that they are stored in a file, where is it exactly?

2) I'm trying to use cloud script to validate the objects a client is trying to set to its player entity (title_player_account)

The client is using the SetObjects function from the API.

Then I set up a handler in my cloud script and created a new rule that triggers when SetObjects is called on a title_player_account.

The question is: How can I pass the arguments the client provided (i.e. the objects) to the cloud code function so that I can do some sort of validation?

3) If I decided to change the objects the client provided, how can I (a) Submit the change to the entity's objects? (b) notify the client about the change with the SetObjectsResponse callback?


10 |1200

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

1 Answer

Seth Du avatar image
Seth Du answered

1) there is no local files that you can directly access. Data in will be displayed in the PlayStream Events and the callbacks of ExecuteCloudScript API call. If you implement tools like SnowFlake or Azure Data Explorer, it will be more convenient to manage.

2) If you set up rules that are triggered by specific PlayStream Events and will execute a Cloud Script function. You may simply refer the data in the PlayStream Events, for example,


Be aware that you may check the property name manually in the event and only string/number is supported which means the structured object will not show even you specify the property name inside the object.

3) Server normally cannot actively inform the clients unless you have accessed our Private Preview Feature Pubsub. You may create a ticket to access it if you are Pro or Enterprise Tier user.

10 |1200

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

Yaser avatar image Yaser commented ·

Thanks for your answers, and sorry for my delayed response.

I got 1 and 2.

For the third question, what I meant was to modify the SetObjectsResponse in the Cloud Script, by adding a customData or changing its result, so that when the client gets the response, he receives the correct information.

Is that possible with Cloud Script?

As to changing the entity's Objects, I meant to call a SetObjectsRequest from the server (Cloud Script), is that possible as well?


0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Yaser commented ·

Yes, Cloud Script is able to execute SetObject API as you may use ExecuteEntityCloudScript API in your client and then refresh the local data after the successfull callback of it is received to get the latest version. In addition, adding whatever you want in the return field of Cloud Script function will ensure the client gets what you want.

The default revision of Cloud Script has a usage sample:

handlers.makeEntityAPICall = function (args, context) {

    var entityProfile = context.currentEntity;

    var apiResult = entity.SetObjects({
        Entity: entityProfile.Entity,
        Objects: [
                ObjectName: "obj1",
                DataObject: {
                    foo: "some server computed value",
                    prop1: args.prop1

    return {
        profile: entityProfile,
        setResult: apiResult.SetResults[0].SetResult
0 Likes 0 ·
Yaser avatar image Yaser Seth Du ♦ commented ·

Thank you very much for answering.

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.