This topic describes how to debug a function by using the fun local start related
commands.
Notice The content described in this article will no longer be maintained later. If your
Function service resources are managed by Funcraft, we recommend that you migrate the resources to
Serverless Devs.
For more information about how to migrate Function Compute-related resources from
Funcraft to Serverless Devs, see Migrate resources from Funcraft to Serverless Devs.
For more information about Serverless Devs, see Overview.
For more information about how to use Serverless Devs to debug functions, see Debug
Functions and Remote debug Using s Local Related Commands.
We apologize for any inconvenience caused.
Debug a local HTTP trigger function by using VSCode
The following section uses Node.js as an example to describe how to use VSCode to
debug HTTP functions.
HTTP triggers are debugged locally in the same way as they are used to trigger functions
using events, as specified by -d
or --debug-port
parameters. It also supports displaying the configuration information of the debugging
IDE during debugging by using -c
or -config
parameters.
- Run the following command to run the function in debug mode:
fun local start -debug 3000 -config vscode
Sample command output:

Note In the returned results, you can see that the function declared in the template.yml file has been successfully registered.
- Choose an appropriate URL based on the service name, function name, or HTTP trigger
name. Use a browser to open the target URL.
The browser page will remain unresponsive. The following logs are displayed in the
terminal. You need to copy the configuration information returned in the log to the
VSCode debugger for configuration.
skip pulling image aliyunfc/runtime-python3.6:1.2.0...
you can paste these config to .vscode/launch.json, and then attach to your running function
///////////////// config begin /////////////////
{
"version": "0.2.0",
"configurations": [
{
"name": "fc/local-http-demo/python3",
"type": "python",
"request": "attach",
"host": "localhost",
"port": 3000,
"pathMappings": [
{
"localRoot": "/Users/tan/fun_local_http_demo/python3",
"remoteRoot": "/code"
}
]
}
]
}
///////////////// config end /////////////////
FunctionCompute python3 runtime inited.
FC Invoke Start RequestId: 04c57fba-cbe9-4c1f-8c57-f8e0b539fa08
- Click the VSCode editor sidebar to set a breakpoint and click the
icon to complete debugging. The dynamic demonstration process is as follows.
