You need to send HTTP requests to the function to test whether the function runs as expected. You can use the Function Compute console or a browser to send HTTP requests to test whether the function is correct.

Test the function in the Function Compute console

  1. Log on to the Function Compute console.
  2. In the top navigation bar, select a region.
  3. In the left-side navigation pane, click Service/Function.
  4. Find the target function in the target service and click the name of the function.
  5. Click the Code tab and scroll down the page to the HTTP Trigger Debugging section.
  6. Enter the key-value pairs in the key and value fields on the Params and Header tabs, respectively.
    After you enter the key-value pairs, you can see the HTTP trigger URL automatically assembled by the Function Compute platform.trigger-url
  7. Click Execute.
    The execution result of the function is displayed.result-execution

Test the function by using a browser

  1. Assemble the HTTP trigger URL.
    The assembly rules of the HTTP trigger URL are as follows:
    <account_id>.<region>.fc.aliyuncs.com/<version>/proxy/<serviceName>/<functionName>/[action? queries]            

    The example is as follows:

    123456.cn-shanghai.fc.aliyuncs.com/2016-08-15/proxy/serviceName/functionName/action? hello=world           
    The parameters in URL are described as follows:
    Parameter Description
    account_id The ID of an Alibaba Cloud account.

    You can retrieve your account ID in Security Settings If you are using a Resource Access Management (RAM) user, move the pointer over your profile picture in the upper-right corner of the console to view your Alibaba Cloud account ID.

    region The region where the Function Compute instance is located.
    version The API version of Function Compute.
    action The custom request path.
    serviceName The service name.
    functionName The function name.
    queries The query parameter.
  2. In the address bar of your browser, enter the HTTP trigger URL and press Enter.
    The browser returns the execution result.