question

web3 avatar image
web3 asked

Cloud script, unable to parse "args".,cloud script, unable to parse "args" function parameter

Unable to access args function parameter.

Could this be cause of free plan?

Our code to access args number var.
const XPToAdd = args.XPAddition;

Our function param.
{ "FunctionName": "ServerPushClientStat", "FunctionParameter": { "args": { "XPAddition": 5, "WinsAddition": 5, "KillsAddition": 5, "MatchesPlayedAddition": 5, "HeadshotsAddition": 5 } }, "PlayFabId": "95F48B3EBD7B2917" }

,

Cloud script is unable to parse args function parameter???
Could this be causes by free tier limitations?

Steps to reproduce,

1. Create cloud script.

2. Call it and pass function parameter.


{ "FunctionName": "ServerPushClientStat", "FunctionParameter": { "args": { "XPAddition": 5, "WinsAddition": 5, "KillsAddition": 5, "MatchesPlayedAddition": 5, "HeadshotsAddition": 5 } }, "PlayFabId": "95F48B3EBD7B2917" }

Result:
Those values will be empty when attempting to access.

const XPToAdd = args.XPAddition; const WinsToAdd = args.WinsAddition; const KillsToAdd = args.KillsAddition; const MatchesPlayedToAdd = args.MatchesPlayedAddition; const HeadshotsToAdd = args.HeadshotsAddition;

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.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

“args” is an object which comes from the ExecuteCloudScriptRequest’s FunctionParameter. So if you want to access the “XPAddition” of your FunctionParameter, it should be “args.args.XPAddition”. Or you can change the FunctionParameter into

{ "XPAddition": 5, "WinsAddition": 5, "KillsAddition": 5, "MatchesPlayedAddition": 5, "HeadshotsAddition": 5 }

then you can access it with args.XPAddition.

For more info about writing CloudScript, please refer to Writing custom 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.

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.