Function is a combination of code, runtime, resources, and settings required to achieve a specific purpose. It is the minimum unit that can run independently. A function can be triggered by triggers and automatically schedule required resources and environments to achieve expected results.
An app groups functions as a service logic unit for easier management. You can create multiple functions under an app.
FunctionGraph allows you to edit function code in the same way as managing a project. You can create and edit files and folders. After you upload a ZIP code package, you can view and edit the code on the console. Table 1 describes the menus of the inline editor.
Menu | Description |
|---|---|
File | Creates files and folders. You can create files, create folders based on templates, and close all files. |
Edit | Edits function code. You can perform the undo, edit, or comment operation. |
Find | Finds and replaces code. |
Go to | Goes to a certain location in the code. You can go to a specified line, brackets, or the next problematic line. |
View | Provides common functions. You can view the command palette and change the display theme. |
Test | Tests a function online, and displays the test result, digest, and logs. |
After a function is created, the default version is latest. Each function has the latest version. You can modify a function based only on its latest version.
Parameter | Description |
|---|---|
Handler |
|
Initializer | You can enable function initialization on the Code tab page after creating a function. The initializer must be named in the same way as the handler. For example, for a Node.js or Python function, set an initializer name in the format of [file name].[initialization function name]. NOTE: This parameter is not required if function initialization is disabled. For details on how to create an initialization function, see Initializing the Function. |
Dependencies | Third-party software packages required by the function. You can manage your dependencies by uploading them to FunctionGraph. If the dependencies are too large, upload them through OBS. For more information, see Dependent Libraries. NOTE: Except your private dependencies, FunctionGraph provides some common dependencies, which you can choose when creating a function. |
Code Entry Mode | Method of entering the function code. For details about the supported code entry modes, see Table 3. |
Runtime | Code Entry Mode | Description |
|---|---|---|
Node.js | Edit code inline | Edit code in the code box. For more information, see Table 4. |
Upload ZIP file | Click Select File and upload a local code package to FunctionGraph. The size of the ZIP file to be uploaded cannot exceed 50 MB. If it exceeds 50 MB, upload the ZIP file using an OBS bucket. | |
Upload file from OBS | Paste the link URL of the OBS bucket storing a code ZIP file. | |
Python | Edit code inline | Edit code in the code box. For more information, see Table 4. |
Upload ZIP file | Click Select File and upload a local code package to FunctionGraph. The size of the ZIP file to be uploaded cannot exceed 50 MB. If it exceeds 50 MB, upload the ZIP file using an OBS bucket. | |
Upload file from OBS | Paste the link URL of the OBS bucket storing a code ZIP file. | |
Java | Upload ZIP file | Click Select File and upload a local code package to FunctionGraph. The size of the ZIP file to be uploaded cannot exceed 50 MB. If it exceeds 50 MB, upload the ZIP file using an OBS bucket. |
Upload JAR file | Click Select File and upload a local JAR file to FunctionGraph. The size of the JAR file to be uploaded cannot exceed 50 MB. If it exceeds 50 MB, convert it into a ZIP file, and upload the ZIP file to OBS. | |
Upload file from OBS | Paste the link URL of the OBS bucket storing a code ZIP file. | |
Go | Upload ZIP file | Click Select File and upload a local code package to FunctionGraph. The size of the ZIP file to be uploaded cannot exceed 50 MB. If it exceeds 50 MB, upload the ZIP file using an OBS bucket. |
Upload file from OBS | Paste the link URL of the OBS bucket storing a code ZIP file. | |
C#(.NET Core) | Upload ZIP file | Click Select File and upload a local code package to FunctionGraph. The size of the ZIP file to be uploaded cannot exceed 50 MB. If it exceeds 50 MB, upload the ZIP file using an OBS bucket. |
Upload file from OBS | Paste the link URL of the OBS bucket storing a code ZIP file. | |
PHP | Upload ZIP file | Click Select File and upload a local code package to FunctionGraph. The size of the ZIP file to be uploaded cannot exceed 50 MB. If it exceeds 50 MB, upload the ZIP file using an OBS bucket. |
Upload file from OBS | Paste the link URL of the OBS bucket storing a code ZIP file. | |
Custom | Edit code inline | Edit code in the code box. For more information, see Table 1. |
Upload ZIP file | Click Select File and upload a local code package to FunctionGraph. The size of the ZIP file to be uploaded cannot exceed 50 MB. If it exceeds 50 MB, upload the ZIP file using an OBS bucket. | |
Upload file from OBS | Paste the link URL of the OBS bucket storing a code ZIP file. | |
Cangjie | Upload ZIP file | Click Select File and upload a local code package to FunctionGraph. The size of the ZIP file to be uploaded cannot exceed 50 MB. If it exceeds 50 MB, upload the ZIP file using an OBS bucket. |
Upload file from OBS | Paste the link URL of the OBS bucket storing a code ZIP file. |
Menu | Description |
|---|---|
File | Creates files and folders. You can create files, file templates, and Python modules, and close all files. |
Edit | Edits function code. You can undo or redo your editing, delete or join lines, add comments, fold and unfold lines, and sort lines in ascending or descending order. |
Find | Finds and replaces code. |
Go to | Goes to a certain location in the code. You can go to a specified line, brackets, or the next problematic line. |
View | Provides common functions. You can view the command palette and change the display theme. |
Test | Tests a function online, and displays the test result, digest, and logs. |
You can export the created functions and their code and configurations.
You can import a ZIP file that contains configurations and code into FunctionGraph.
If the ZIP file to be uploaded contains sensitive information (such as account passwords), encrypt the sensitive information to prevent leakage.
Figure 1 Resource package

The following shows an example YAML configuration file. The fields in this file are described in Table 5.
HcCrmTemplateVersion: v2Resources:HelloWorld:Type: HC::Serverless::FunctionProperties:Handler: index.handlerRuntime: Node.js6.10CodeType: inlineCodeFileName: index.jsDependencyPkg: ""Description: ""MemorySize: 128Timeout: 3Version: latestEnvironment:Variables: {}
Parameter | Description |
|---|---|
HcCrmTemplateVersion | Fixed value: v2. |
Resources | Function details. |
Type | Fixed value: HC::Serverless::Function. |
Properties | Function information. |
Handler | Handler of the function. |
Runtime | Running environment. |
CodeType | Code entry mode, which can be jar, zip, or inline. |
CodeFileName | Code file name. |
DependencyPkg | Dependency address. |
Description | Description of the function. |
MemorySize | Memory size. |
Timeout | Function execution timeout. |
Version | Function version. |
Environment | Environment variables. |
Disabled functions can no longer be executed.
Disabled functions can be enabled again as required.
You can delete unused functions to release resources.