This topic describes the steps and command format for using fun local invoke commands to run event functions in different languages.
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.
Command syntax
- Run the function by using the function name.
fun local invoke <your function>
- Run the service name /function name.
fun local invoke <your service>/<your function>
- You can directly use the fun local invoke to run the function. You can use the Service Name /Function Name method to match the function.
- If the template.yml contains multiple services and multiple services contain functions with the same name, if the function name is called, the Funcraft tool will only run the first matching function.
Node.js and Python functions
Node.js and Python functions run in the same way. The following example describes
how to run a Node.js function by using the function name demo and application template event-nodejs8
.
You can also use -d
parameters to debug Node.js and Python functions. For more information, see Debug Node.js and Python functions.
Java functions
The following example describes how to run a Java function by using the function name
demo and application template event-java8
.
You can also use -d
parameters to debug Java functions. For more information, see Debug Java functions.
PHP functions
The following example describes how to run a PHP function by using the function name
demo and application template event-php7.2
.
You can also debug PHP functions with -d
parameters. For more information, see Debug PHP functions.