Management Features for Server Code

You can take the following management actions on your server codes.

  • 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.

  • Managing server code versions

    You can manage the deployed server code and server hook configuration files (i.e. activating and deactivating a 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 purposes. 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.

  • 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.

    For details on how to manage the results, please refer to Managing Server Code with Command Line Tool and Managing Server Code with Developer Portal.

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 for the 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 operation, 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.

  • 6: Engine equivalent to Node.js 6.X.
  • 16: Engine equivalent to Node.js 16.X.
  • v20240715: Stable version of 16 (no functional differences from 16)
Phase Schedule Available versions
Current Until Dec. 11, 2024 6 (Default), 16
Transition From Dec. 12, 2024 to Jan. 31, 2025 (Planned) 6 (Default), 16, v20240715
Operation From Feb. 1, 2025 (Planned) v20240715 (Default), 16
…… …… ……

During the transition period, you can keep the currently available version of the JavaScript engine and 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 from time to time.

The specification of ES6 or later is not supported even if v20240715 or 16 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 in the current Kii Cloud environment, the default JavaScript engine will be used.