fastly compute serve

Build and run a Compute package locally.

Syntax

$ fastly compute serve

Options

KeyRequired?DefaultDescription
--addrNo127.0.0.1:7676The IPv4 address and port to listen on
--dirNoProject directory to build (default: current directory)
--envNoThe manifest environment config to use (e.g. 'stage' will attempt to read 'fastly.stage.toml')
--fileNo./bin/main.wasmThe Wasm file to run (causes validation checks for ./bin/main.wasm to be skipped)
--include-sourceNoInclude source code in built package
--languageNoLanguage type
--metadata-disableNoDisable Wasm binary metadata annotations
--metadata-filter-envvarsNoRedact specified environment variables from [scripts.env_vars] using comma-separated list
--metadata-showNoInspect the Wasm binary metadata
--package-nameNoPackage name
--profile-guestNoProfile the Wasm guest under Viceroy (requires Viceroy 0.9.1 or higher). View profiles at https://profiler.firefox.com/.
--profile-guest-dirNoThe directory where the per-request profiles are saved to. Defaults to guest-profiles.
--skip-buildNoSkip the build step
--timeoutNoTimeout, in seconds, for the build compilation step
--viceroy-checkNoForce the CLI to check for a newer version of the Viceroy binary
--viceroy-pathNoThe path to a user installed version of the Viceroy binary
--watchNoWatch for file changes, then rebuild project and restart local server
--watch-dirNoThe directory to watch files from (can be relative or absolute). Defaults to current directory.

Global options

KeyRequired?DefaultDescription
--helpNoShow context-sensitive help.
--accept-defaultsNoAccept default options for all interactive prompts apart from Yes/No confirmations
--auto-yesNoAnswer yes automatically to all Yes/No confirmations. This may suppress security warnings
--debug-modeNoPrint API request and response details (NOTE: can disrupt the normal CLI flow output formatting)
--non-interactiveNoDo not prompt for user input - suitable for CI processes. Equivalent to --accept-defaults and --auto-yes
--profileNoSwitch account profile for single command execution (see also: 'fastly profile switch')
--quietNoSilence all output except direct command output. This won't prevent interactive prompts (see: --accept-defaults, --auto-yes, --non-interactive)
--tokenNoFastly API token (or via FASTLY_API_TOKEN)
--verboseNoVerbose logging

Examples

Build and run a Compute package locally

The compute serve command wraps the existing build command. All flags present on the fastly compute build command are available to use here. Additionally, the --watch command enables 'hot reloading' of your project code whenever changes are made to the source code.

$ fastly compute serve --watch