Invokes deployed function. It allows to send event data to the function, read logs and display other important information of the function invocation.
serverless invoke -f functionName
serverless invoke -f functionName --data "{}"
serverless invoke -f functionName --path data.json
$ cat data.json
{
"Key": "Spotinst Functions is Value"
}
--function
or-f
The name of the function in your service that you want to invoke. Required.--data
or-d
String data to be passed as an event to your function. By default data is read from standard input.--path
or-p
The path to a json file with input data to be passed to the invoked function. This path is relative to the root directory of the service.--type
or-t
The type of invocation. EitherRequestResponse
,Event
orDryRun
. Default isRequestResponse
.--log
or-l
If set totrue
and invocation type isRequestResponse
, it will output logging data of the invocation. Default isfalse
.