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.
RequirementsAnchor 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
_startfunction 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:
Read input as a JSON encoded byte stream from a standard input file descriptor:
Write debug logs as a newline delimited
utf-8file to a standard error file descriptor:
Valid module exampleAnchor link to section titled "Valid module example"
The following code sample shows a valid module in WebAssembly text format (WAT).