Invokes deployed function locally. It allows to send event data to the function, read logs and display other important information of the function invocation.
serverless invoke -f functionName
--function
or-f
The name of the function in your service that you want to invoke. Required. _--data
or-d
Data you want to pass into the function--path
or-p
Path to JSON or YAML file holding input data. This path is relative to the root directory of the service.--raw
Pass data as a raw string even if it is JSON. If not set, JSON data are parsed and passed as an object.--contextPath
or-x
, The path to a json file holding input context to be passed to the invoked function. This path is relative to the root directory of the service.--context
or-c
, String data to be passed as a context to your function. Same like with--data
, context included in--contextPath
will overwrite the context you passed with--context
flag.
Keep in mind that if you pass both
--path
and--data
, the data included in the--path
file will overwrite the data you passed with the--data
flag.
serverless invoke local -f functionName
serverless invoke local -f functionName -d '{ "data": "hello world" }'
serverless invoke local -f functionName -p path/to/file.json
# OR
serverless invoke local -f functionName -p path/to/file.yaml