Updated on 2025-08-19 GMT+08:00

Editing Function Code Inline

This section describes how to edit and deploy function code on the FunctionGraph console, and how to view and modify the function handler.

Scenarios

FunctionGraph provides an SDK for editing code in Node.js, Python, PHP, and custom runtime. If your function code depends only on the SDK library, you can edit code using the inline editor on the Code tab page of the FunctionGraph console. If you have developed function code locally, upload the function code by referring to Uploading Function Code.

In the inline code editing area, you can manage files and folders in the same way as managing projects. For details, see Editing Function Code Inline.

Notes and Constraints

  • Only Node.js, Python, PHP, and custom runtime functions support inline code editing.
  • If the code deployed in the inline code editor is greater than 20 MB, the code is not displayed, as shown in Figure 1. However, the function code can still be tested.
    Figure 1 Code not displayed in the editor

Editing Function Code Inline

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click a function name to go to the function details page.
  3. On the Code tab page, edit the function code inline.
  4. After editing the code, click Deploy. The console compresses the code and related configurations into a code file that can run on FunctionGraph. No other operations are required.

    If the code is modified, click Deploy again.

Inline code editing area management:

The inline code editing area provides project-based code file management capabilities as shown in Figure 2. You can create files and folders, and edit and set code in the code box.

  • File: You can create files and folders, and save and close all files.
  • Edit: Undo/redo typing; cut, copy, and paste code; find and replace content.
  • Settings: You can set the font size of the code, the theme color of the code box, and whether to automatically format the code.
    Figure 2 Code area management

Modifying the Function Handler

Function handler is the entry point specified in the function code for executing logic. Generally, it is a specific function or method. When a function is triggered, the code is executed from the handler.

For details about the naming rules of function handlers in different runtimes, see Table 1.

Table 1 Rules for configuring the function handler

Runtime

Handler Rule

Example

Node.js

[File name].[Handler name]

myfunction.handler

Python

PHP

Java

[Package name].[Class name].[Execution function name]

com.xxxxx.exp.Myfunction.myHandler

Go

The handler name must be the same as that of the executable file in the code file.

handler

C#

[Assembly name]::[Namespace].[Class name]::[Execution function name]

CsharpDemo::CsharpDemo.Program::MyFunc

The following uses a Python function as an example to describe how to view and modify the function handler on the function details page.

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click a function name to go to the function details page.
  3. Choose Configuration > Basic Settings. View and modify the handler information as shown in Figure 3. After the modification, click Save.

    Figure 3 Handler

  4. On the Code tab page, modify the file name and function name based on the handler, as shown in Figure 4.

    Figure 4 File name and execution function name

Helpful Links