Shopify Functions now support a WebAssembly query API, letting you build smaller, faster, and more powerful functions. Deserialize data just-in-time, and only pay for the fields your function actually uses.
How does this impact function-runner? Will we have to change the way we pass arguments to function-runner? Does function-runner include the WebAssembly Query API, or will Functions still be parsing JSON themselves within this context?
Our app currently has a feature that uses function-runner to determine how many instructions were executed (so that we can detect and diagnose InstructionCountLimitExceededError). We are planning to update our .wasm executable to use the WebAssembly Query API for input parsing instead of JSON. However, I’m worried that doing this will break the aforementioned feature, if function-runner doesn’t support the Query API.
I’ve connected with the Functions team and as long as you are on the latest version of the CLI we detect whether you are using the WebAssembly API with the function runner, you do not need to change the arguments you pass to it.
Hey @tobebuilds - looks like you found a resolution in the Github issue thread there, but since it does definitely seem to be something we should document, so I’ll share your thread there with our product team to see if we can get that done or further investigate function-runner itself if needed.
Really appreciate all the digging you did into this to get a workaround set up, I’ll loop back with you here once I have more info to share
Hey @tobebuilds - I was able to touch base with the product team on this, and running shopify app function build before shopify app function run should run the trampoline command automatically.
If you did need to use cargo directly though rather than via Shopify CLI, just let me know and I can take another look - hope this helps.
Thanks for the update! I currently build my functions using a custom script that runs wasm-opt, removes panicking code, trampoline, etc.. I will try shopify app function build to see if it applies similar optimizations before fully migrating.
No worries @tobebuilds! If you’re still encountering issues even after integrating shopify app function build into your setup flow (or if that doesn’t work for you when it comes to your dev flow), just let me know and I’d be happy to put through a feature request to make this better at the very least for you