I have reproduced the issue on the latest CLI version.
Yes, I am on the latest version
I have searched existing posts and this report is not a duplicate.
Yes, this isn’t a duplicate
In which of these areas are you experiencing a problem?
App
Extension
Function
Expected behavior
Running vitest on a Rust function extension should load the compiled WASM binary from dist/index.wasm and execute tests successfully.
Actual behavior
Tests fail immediately with:
Error: Couldn’t load the Function “…dist/index.wasm”: expected (
The file at dist/index.wasm contains base64-encoded text instead of a raw WASM binary. The wasmi parser rejects it (expected (`` is the start of a valid WASM binary’s magic bytes in text format).
Reproduction steps
- Create a new Rust function extension: shopify app function new (select Rust)
- Build it: shopify app function build
- Run tests: vitest
Observed on CLI 3.93.0 and 3.93.1. Works correctly on 3.92.1.
Root cause is in PR #7161 — two changes interact:
- outputPath in extension-instance.ts now always returns dist/index.wasm (ignoring build.path in shopify.extension.toml)
- The bundling guard in bundleFunctionExtension() (extension.ts) gained a directory-equality check that evaluates to false when both paths are in dist/, causing base64-encoded content to be written to dist/index.wasm
Ref: cli/packages/app/src/cli/services/build/extension.ts at 3.93.0 · Shopify/cli · GitHub
Verbose output
% shopify app function build --verbose
…
✓ Built successfully
% npm run test
…
FAIL extensions/my-function/src/index.test.ts
● test suite failed to run
Error: Couldn't load the Function ".../extensions/my-function/dist/index.wasm": expected `(`
at loadFunction (node_modules/@shopify/shopify_function/index.js:...)
(The expected (error originates from the wasmi WASM parser receiving base64 text instead of a binary —dist/index.wasm is overwritten with base64 content during the build step.)
Operating system
any
CLI version
3.93.1
Shell
bash
Nodejs version
v24.14.1