run Commands

Commands to run a function.

run function

Send a cloudevent to a function.

Examples for run function

Run a function:

Run a function with a payload and a JSON response:

Usage

sf run function
[--json]
[-l FUNCTION-URL]
[-H HEADERS]
[-p PAYLOAD]
[-s]
[-o CONNECTED-ORG]

Flags

--json
Optional

Format output as json.

Type: boolean
-l | --function-url FUNCTION-URL
Optional

URL of the function to run.

Type: option
-H | --headers HEADERS
Optional

Set headers.

Type: option
-p | --payload PAYLOAD
Optional

Set the payload of the cloudevent as a JSON object or a path to a file via @file.json.

Type: option
-s | --structured
Optional

Set the cloudevent to be emitted as a structured JSON cloudevent.

Type: boolean
-o | --connected-org CONNECTED-ORG
Optional

Username or alias for the target org; overrides default target org.

Type: option

run function start

Build and run a Salesforce Function.

Description for run function start

Run this command from the directory of your Salesforce Functions project.

This command will run the target function locally (on the same operating system as this CLI), just like the `local` subcommand.

Examples for run function start

Build a function and start the invoker

Start the invoker with a specific language and port

Usage

sf run function start
[-p PORT]
[-b DEBUG-PORT]
[-l LANGUAGE]
[-v]

Flags

-p | --port PORT
Optional

Port for running the function.

Type: option
Default value: 8080
-b | --debug-port DEBUG-PORT
Optional

Port for remote debugging.

Type: option
Default value: 9229
-l | --language LANGUAGE
Optional

The language that the function runs in.

Type: option
Permissible values are: auto, java, javascript, typescript
Default value: auto
-v | --verbose
Optional

Output additional logs.

Type: boolean

run function start container

Usage

sf run function start container

run function start local

Description for run function start local

Build and run a Salesforce Function locally.

Examples for run function start local

Build a function and start the invoker

Start the invoker with a specific language and port

Usage

sf run function start local
[-p PORT]
[-b DEBUG-PORT]
[-l LANGUAGE]

Flags

-p | --port PORT
Optional

Port to bind the invoker to.

Type: option
Default value: 8080
-b | --debug-port DEBUG-PORT
Optional

Port to use for debugging the function.

Type: option
Default value: 9229
-l | --language LANGUAGE
Optional

The language in which the function is written.

Type: option
Permissible values are: auto, java, javascript, typescript
Default value: auto