All Products
Document Center

2. Debug the function

Last Updated: Dec 11, 2018

In the Function Compute console, complete the following steps:

  1. On the code management page, click Event.
  2. Create the event based on your needs. You can set JSON string or raw string.
  3. Click OK.

This creates the event that is sent by the MNS topic trigger to the function. You can use this method to debug and test the function.

Configure the MNS topic trigger

  1. On the code management page, click Triggers.

  2. Set the type of the trigger to MNS Topic Trigger and select the topic created in step one.

Note: We recommend that you select a topic that has the same region as the function.

  1. Select the system role AliyunMNSNotificationRole as the trigger role.
  • For each trigger, you need to specify a trigger role that is authorized to trigger the function. MNS needs to be assigned these permissions to trigger the function.

  • For more information about roles, see User permissions.

Test the trigger

After you have configured the trigger, log on to the Message Service console, find the topic, and check its subscription list. If the function is subscribed to this topic, publish a message to this topic and use Log Service to check if the function has been executed.