Skip to main content

Parameter parsing for scripts

Create script, Update script, and Deploy commands evaluate parameters from a Cloud Code script.

In the example Script.js, one parameter with name range and type NUMERIC is parsed and uploaded to UGS.

For more details, check Declare parameters in the script.

Append Parameter into Cloud Code Script during Fetch

To ensure that the Fetch command is fetching the exact Cloud Code script information from the service, UGS CLI will look up parameters declared for the script in the service.

If there are parameters declared from the service and there are no parameter in service script code, the Fetch command will update local script code and declare parameters. This means a section like this might be appended into your local script code:

module.exports.params = {
//Parameters declared in service

If there are any parameters declared in-script from the service, UGS CLI will not update the parameters.

Parsing Limitations

Create script and Update script evaluate the given Cloud Code script to parse the parameters. As a result, these commands cannot parse parameters if you declare them at the beginning and overwrite/delete them after.

For example, this script is problematic:

const _ = require("lodash-4.17");

const NUMBER_OF_SIDES = 6;

module.exports.params = {
sides: "NUMERIC"

module.exports = async ({ params, context, logger }) => {
// ...

// Functions can exist outside of the script wrapper
function rollDice(sides) {
return _.random(1, sides);

The script defines module.exports.params at the beginning, but then it is overwritten by module.exports = async ..., so Create script or Update script cannot parse the parameters.