WebAssembly support in Shopify Functions
You can write your functions in any language that can compile to WebAssembly (Wasm), such as Rust, Zig, or TinyGo. This guide describes how to generate Wasm that conforms to Shopify Functions standards.
Requirements
Anchor link to section titled "Requirements"Functions that are compiled to Wasm need to meet the following requirements:
Conform with the command module structure referenced in the unstable WASI application ABI specification. The function needs to export a
_start
function of type(func)
, take no arguments, and have no return values.Write output as a JSON encoded byte stream to a standard output file descriptor:
STDOUT (fd=1)
Read input as a JSON encoded byte stream from a standard input file descriptor:
STDIN (fd=0)
Write debug logs as a newline delimited
utf-8
file to a standard error file descriptor:STDERR (fd=2)
Valid module example
Anchor link to section titled "Valid module example"The following code sample shows a valid module in WebAssembly text format (WAT).