CLI 3.93.0 regression: vitest WASM tests fail for Rust function extensions (base64 written to dist/index.wasm instead of raw binary)

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

  1. Create a new Rust function extension: shopify app function new (select Rust)
  2. Build it: shopify app function build
  3. 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

2 Likes

Hey @jmichal - thanks for the detailed write-up here, and for tracking down the root cause. Really helpful.

I did some digging on our end and this looks like it may be related to a recent change in how the build process handles the output path for function extensions.

I’m going to flag this internally so we can get this looked into. If you’re fully blocked on this in the meantime, rolling back to 3.92.1 should get you unblocked, but I’ll loop back here once I have more info.

Let me know if I can help out further.

1 Like