Management Features for Server Code

Install the command line tool to your development PC to manage server code.

You can take the following management actions with the command line tool:

  • Deploying a server code file and a server hook configuration file

    You can upload a server code (in JavaScript) file and a server hook configuration file from your PC to Kii Cloud. You can also download the deployed server code and server hook configuration files.

  • Managing server code versions

    You can manage the deployed server code and server hook configuration files (i.e. activating and deactivating the certain version). See Managing server code versions for more details.

  • Inspecting the developer log

    You can browse the developer log to check messages recorded by your server code for debugging purpose. See Developer Log to learn how to record some debug messages from server code.

    Note that the developer log is not just for the server extension. The log includes records of various executions by the client SDK. See Inspect Developer Log for more details.

  • Inspecting the history of execution results of server code called by schedule-based hooks

    You can browse the history of execution results of server code called by schedule-based hooks. You can check the results of auto-executions and the values returned by the server code. See Checking Results of Schedule-based Hooks for more details.

You need the ClientID and ClientSecret when using the command line tool. These values are the access keys that should be kept secret so as to prevent malicious users from gaining accesses to your server code.

Managing server code versions

Kii Cloud allows you to manage a pair of server code and a server hook configuration file as a version. This feature makes it easy for you to quickly revert to a previous version of your server code if you find a defect in the current version. You can switch to a previous version with just one command.

The unit of versioning and switching is a pair of a JavaScript file of server code and a server hook configuration file. If you have multiple endpoints or your server code uses libraries that are external to Kii Cloud, include all of the source code in one server code file. Similarly, include the corresponding configurations in one server hook configuration file, and then register the file pair. If you execute server code only manually, a server hook configuration file is not required.

An application on Kii Cloud accepts multiple versions for development and maintenance. You can activate one version at a time. An active version is executed when the server code is manually executed on a mobile app or automatically executed by a server hook. when a version is activated, the other versions are deactivated.

When you register a server code file and a server hook configuration file, Kii Cloud will return a version code like gulsdf6ful8jvf8uq6fe7vjy6. You will use this version code when you activate and deactivate the version and when you delete the version.

JavaScript engine

Kii Cloud regularly updates the JavaScript engine (Node.js) for execution of server code.

When the JavaScript engine is updated, details of the JavaScript syntax and the specification of the libraries provided by Node.js might change. This change can make your server code run differently and issue an execution error. You can see such an execution error through an error code resulting from a failed manual opeartion, the history of automatic execution, the developer log, and so on.

If the update of the JavaScript engine does not affect your server code implementation, you do not need to do anything special. When the default JavaScript engine is updated on Kii Cloud, your server code is automatically migrated to the new environment. However, to ensure stable operation, it is recommended to test your server code on the new JavaScript engine during the transition period.

See the table below for the planned transition schedule of the JavaScript engine. During the transition period, you can keep the currently available version of the JavaScript engine the default version and use the new version in parallel. Test your server code during this period. When the transition period ends, only the new engine remains available.

The version of the JavaScript engine will be updated time to time.

Phase Schedule Available versions
Transition Now Node.js 6.X (default) and Node.js 16.X
Operation Soon Node.js 16.X (default)
…… …… ……

The specification of ES6 or later is not supported even Node.js v16.X or later is used as the JavaScript engine. Only the specification of ES5 is supported.

Setting the JavaScript engine

You can set the JavaScript engine on which your server code is executed per version of the server code. if you register server code without the version of the JavaScript engine, the server code will be executed on the default version of the JavaScript engine for Kii Cloud.

In order to test the latest JavaScript engine during the transition period, re-register the active server code and the server hook configuration file with the latest JavaScript engine specified.

When you manually execute server code with the REST API, you can specify the version of the JavaScript engine with a parameter. When the parameter is specified, the version specified at the server code registration will be ignored.

Determining the JavaScript engine to use

The JavaScript engine for your server code is determined under the following rules.

  • When the server code is manually executed, you can specify the JavaScript engine to use with a parameter. If the specified JavaScript engine is unavailable on the current Kii Cloud environment, the REST API will return an error.

  • When the server code is automatically executed or manually executed without the JavaScript engine specified, the engine specified for each version of the server code will be used. If the engine is not specified or the specified engine is unavailable on the current Kii Cloud environment, the default JavaScript engine will be used.