tencent cloud


Creating a Trigger

Last updated: 2023-04-27 17:26:57
    After creating a function, you can create a trigger to associate the function with an event source. The associated event source will trigger the function synchronously or asynchronously as specified when an event is generated, and the event will be passed to the entry function as an input parameter upon triggering.
    A function trigger can be created in the console or through Serverless Cloud Framework CLI.
    Only API Gateway triggers can be created for HTTP-triggered functions. For more information, see Creating and Testing Function.

    Creating a Trigger in the Console

    1. Log in to the SCF console and click Functions on the left sidebar.
    2. At the top of the Functions page, select the region and namespace where the function resides.
    3. Click the function name to enter the function details page.
    4. Select Trigger management on the left to enter the trigger browsing and operation page. Click Create trigger to create a trigger.
    5. In the Create trigger pop-up window, select the trigger alias/version and trigger method.
    Trigger alias/version: Switch to the desired trigger version. A trigger can be created on a specified version of a function. An event of the trigger created in this manner will trigger the code on the specified version. For more information, see Overview.
    There are certain quota limits for the total number of triggers and number of triggers in each type for a function. Triggers created on different versions take up the quota of the function. To increase the limit, contact us for application.
    Trigger method: The information to be entered varies by trigger method. For example, for a timer trigger, you need to enter the trigger name, cycle, and status. For a COS trigger, you need to enter the COS bucket, event type, and prefix/suffix filters. For more information, see Overview.
    6. After completing the trigger configuration, click Submit to create the trigger.

    Creating Trigger on Serverless Cloud Framework CLI

    Before starting, install the Serverless Cloud Framework CLI tool first as instructed in Installation.
    For local functions, add the trigger description in the serverless.yml file. Then, run the scf deploy command on Serverless Cloud Framework CLI to add a trigger to the function.
    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