Overview
Menu

Function Management

Overview

This document describes how to create, edit, and delete an edge function, and how to configure the rules that trigger the function.

Creating and Deploying a Function

1. Log in to the EdgeOne console, click Site List in the left sidebar, and click the site to be configured in the site list.
2. On the site details page, click on Edge Functions > Function Management.
3. On the Edge Function Management page, click Create function, select to create a function using a template. In this step, you can create a function using a template on your actual business needs.
4. On the create new Edge Function page, configure the relevant parameters as follows:
Function: required, it can only include letters, numbers, hyphens. It must start with a letter and end with a digit or letter, 2-30 characters; it cannot be modified after creation. Example: test-edgefunctions.
Description: optional, it supports up to 60 characters. For instance, custom HTML page and response headers.
Code: the content of the edge function that requires a response.

5. Click on Create and deploy. If a dialog box appears as shown, it signifies the successful deployment.


After the deployment is successful, you can click Default access domain name assigned by the platform to verify its effectiveness by triggering the function execution.

If the default function code is deployed, it will be displayed as follows:


Configuring a Triggering Rule

If you want to trigger function execution by setting HOST, URL Path or file suffix of the matching site, there are two steps you can follow:
1. After the function is deployed successfully, click Add triggering rule.
2. On the Add triggering rule page, specify the matching type, operator, and value as needed.


3. Click OK.



Editing the Function

1. On the function management page, select the function you want to modify and click on Function.

2. On the function information page, click Save and deploy or Ctrl + S after modifying the function code.

3. Modify the code and click Save and deploy. If you have configured a triggering rule for the function, a note will be displayed as follows:


Deleting the Function

1. If you need to delete a newly created function, you can go to the function management page, select the function you want to delete, and click on the Delete button in the operation column.

2. In the pop-up dialog box, click OK.
Note
Once deleted, the function cannot be restored. The triggering rules of the function will also be deleted.