Fastly Compute "fastly compute build" Wasm failure in CI
Fastly Compute compiles your application to a WebAssembly module using the build command in fastly.toml. When that build script fails, or the language toolchain (Rust, JS) is not present, fastly compute build exits before producing the .wasm package.
What this error means
The CI step fails with "Error: error building project" or "The [scripts.build] command terminated with a non-zero exit code". No package.tar.gz is produced for deploy.
Error: error building project with build command.
Caused by:
The `[scripts.build]` command terminated with a non-zero exit code.Common causes
The build command fails or the toolchain is missing
The [scripts.build] command in fastly.toml depends on a compiler or bundler (cargo, npm) that errored or is not installed on the runner.
The wasm32 target is not installed
For Rust Compute projects, the wasm32-wasi target must be added; without it cargo cannot produce the Wasm module.
How to fix it
Provision the toolchain before building
- Install the language toolchain the build command needs on the runner.
- For Rust, add the wasm target.
- Re-run
fastly compute buildso the build script succeeds.
rustup target add wasm32-wasi
fastly compute buildReproduce the build command directly
Run the exact [scripts.build] command from fastly.toml to see the underlying compiler error, then fix that.
# fastly.toml
[scripts]
build = "npm run build"How to prevent it
- Install the language toolchain and wasm target as an explicit CI step.
- Run the build command directly to surface compiler errors.
- Pin toolchain versions so the Wasm build is reproducible.