tencent cloud

Feedback

Function Management

Last updated: 2024-08-26 16:24:48

    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 then click the site to be configured in the site list.
    2. On the site details page, click Edge Functions > Function Management.
    3. On the edge function management page, click Create function and select using a template to create a function. At this step, you can use a template to create a function based on actual business needs. Taking the current scenario as an example, you can select the "Create Hello World" template to create a function. After selecting the template, click Next.
    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 code corresponding to the template.
    
    5. Click 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 the function name. On the basic information page of the function details, click Edit Code.
    
    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 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.
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support