You can perform remote debugging on web apps that use the native runtime by using debugging instances. A cloud-based debugging instance with a custom lifetime is provided for temporary testing. This solution saves the trouble of repeated modification, release, and verification in the testing procedure.
Considerations
- Only the web apps built on Native runtime can be debugged by creating debugging instances. Only the API Gateway (APIG) trigger can be used to simulate traffic tests when using debugging instances. For how to create web apps built on Native runtime, see Creating web apps.
- After a debugging instance is created, it will not be updated along with the later releases of the web app.
- A function can only have one debugging instance. The newly created instance will replace the old one.
- Debugging instances are billed as reserved instances.
Creating debugging containers
warning
Only applicable to the web apps built on Native runtime.
- In the top navigation pane, select the region where your business is located.
- In the left navigation pane, click Function. On the page that appears, click the name of the target function to go to the details page of the function.
- On the Development and debugging tab, click Create debugging container in the Debugging container section.
- In the Create debugging container panel, specify the related parameters and then click Create.
tip
Create the debugging instance based on the configuration of the latest version for the function. After you create the debugging instance, you can view the debugging instance in the Instances section on the Resource management tab.
Viewing debugging instances
warning
Only applicable to the web apps built on Native runtime.
After the debugging instance is created, click the instance name to go to the Resource Management tab. You can view the debugging instance information in the Instances section.
- The name of a debugging instance starts with debug and allows you to view the basic information about the instance, such as the availability zone (AZ), status, and start time.
- You cannot migrate debugging instances.
- You can perform the following operations on debugging instances:
- View instance logs: Click Log to view the standard output logs of the target debugging instance.
- Webshell login: Click Webshell to log in to the target debugging instance and run command line interface (CLI) commands on the instance.
- Delete a debugging instance: Click Delete. After a secondary confirmation, you can delete the debugging instance.
warning
After you delete the debugging instance, the current debugging environment cannot be restored. Proceed with caution.
Testing functions
Web apps built on Native runtime allow you to create debugging instances. After a debugging instance is created, it can be used for function testing.
tip
Non-web apps cannot use debugging instances for function testing. They are tested online only.
- In the top navigation pane, select the region where your business is located.
- In the left navigation pane, click Function. Select the name of the target function on the page to go to the details page of the function.
- Go to Development and debugging > Function test, and select Online instance or Debug instance as needed.
- Click Test now to start function testing. You can view the test results at the top of the Function test panel.