Skip to content

"Using Wasm modules" edge function documentation code does not work #640

@lewinpauli

Description

@lewinpauli

Improve documentation

Link

https://supabase.com/docs/guides/functions/wasm

Describe the problem

when I follow the exact documentation the edgefunction with wasm module throws the following error:

Error occurs locally as well as deployed to supabase cloud

supabase functions serve wasm-add                                                  
WARN: no SMS provider is enabled. Disabling phone login
Setting up Edge Functions runtime...
2025-10-27T18:56:53.703493794Z Serving functions on http://127.0.0.1:54321/functions/v1/<function-name>
2025-10-27T18:56:53.703586127Z  - http://127.0.0.1:54321/functions/v1/wasm-add
2025-10-27T18:56:53.703590211Z Using supabase-edge-runtime-1.69.14 (compatible with Deno v2.1.4)
2025-10-27T18:57:06.033104008Z serving the request with supabase/functions/wasm-add
2025-10-27T18:57:06.078594800Z runtime has escaped from the event loop unexpectedly: event loop error: TypeError: NetworkError when attempting to fetch resource
2025-10-27T18:57:06.078617550Z     at opFetchSend (ext:deno_fetch/26_fetch.js:92:10)
2025-10-27T18:57:06.078620675Z     at mainFetch (ext:deno_fetch/26_fetch.js:191:18)
2025-10-27T18:57:06.078624508Z     at ext:deno_fetch/26_fetch.js:419:11
2025-10-27T18:57:06.078625758Z     at new Promise (<anonymous>)
2025-10-27T18:57:06.078627466Z     at fetch (ext:deno_fetch/26_fetch.js:369:20)
2025-10-27T18:57:06.078628758Z     at file:///var/tmp/sb-compile-edge-runtime/wasm-add/add-wasm/pkg/add_wasm.js:28:54
2025-10-27T18:57:06.078754091Z failed to send request to user worker: event loop error: TypeError: NetworkError when attempting to fetch resource
2025-10-27T18:57:06.078787841Z     at opFetchSend (ext:deno_fetch/26_fetch.js:92:10)
2025-10-27T18:57:06.078791133Z     at mainFetch (ext:deno_fetch/26_fetch.js:191:18)
2025-10-27T18:57:06.078793675Z     at ext:deno_fetch/26_fetch.js:419:11
2025-10-27T18:57:06.078795716Z     at new Promise (<anonymous>)
2025-10-27T18:57:06.078798425Z     at fetch (ext:deno_fetch/26_fetch.js:369:20)
2025-10-27T18:57:06.078800341Z     at file:///var/tmp/sb-compile-edge-runtime/wasm-add/add-wasm/pkg/add_wasm.js:28:54
2025-10-27T18:57:06.078967175Z user worker failed to respond: event loop error: TypeError: NetworkError when attempting to fetch resource
2025-10-27T18:57:06.078979175Z     at opFetchSend (ext:deno_fetch/26_fetch.js:92:10)
2025-10-27T18:57:06.078980800Z     at mainFetch (ext:deno_fetch/26_fetch.js:191:18)
2025-10-27T18:57:06.078982133Z     at ext:deno_fetch/26_fetch.js:419:11
2025-10-27T18:57:06.078983383Z     at new Promise (<anonymous>)
2025-10-27T18:57:06.078984883Z     at fetch (ext:deno_fetch/26_fetch.js:369:20)
2025-10-27T18:57:06.078986175Z     at file:///var/tmp/sb-compile-edge-runtime/wasm-add/add-wasm/pkg/add_wasm.js:28:54
2025-10-27T18:57:06.082367425Z InvalidWorkerResponse: event loop error: TypeError: NetworkError when attempting to fetch resource
2025-10-27T18:57:06.082399716Z     at opFetchSend (ext:deno_fetch/26_fetch.js:92:10)
2025-10-27T18:57:06.082401925Z     at mainFetch (ext:deno_fetch/26_fetch.js:191:18)
2025-10-27T18:57:06.082403133Z     at ext:deno_fetch/26_fetch.js:419:11
2025-10-27T18:57:06.082404300Z     at new Promise (<anonymous>)
2025-10-27T18:57:06.082405591Z     at fetch (ext:deno_fetch/26_fetch.js:369:20)
2025-10-27T18:57:06.082406800Z     at file:///var/tmp/sb-compile-edge-runtime/wasm-add/add-wasm/pkg/add_wasm.js:28:54
2025-10-27T18:57:06.082408008Z     at async Function.allSettled (<anonymous>)
2025-10-27T18:57:06.082409216Z     at async UserWorker.fetch (ext:user_workers/user_workers.js:84:63)
2025-10-27T18:57:06.082410425Z     at async Object.handler (file:///var/tmp/sb-compile-edge-runtime/root/index.ts:176:14)
2025-10-27T18:57:06.082411633Z     at async mapped (ext:runtime/http.js:231:18) {
2025-10-27T18:57:06.082412800Z   name: "InvalidWorkerResponse"
2025-10-27T18:57:06.082414133Z }

Describe the improvement

please provide a documentation with code that works

in the documentation it says "You will need update Supabase CLI to 2.7.0 or higher for the static_files support."

but the currently highest supabase cli version available is 2.53.6

it would also be nice to mention that the "wasm-pack" need to be installed first and that the user needs to go into add-wasm folder first before executing the "wasm-pack build --target deno" command

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions