codeapp icon indicating copy to clipboard operation
codeapp copied to clipboard

Fetch fails on Node.js (WebAssembly error)

Open BZ110 opened this issue 6 months ago • 1 comments

What Happened:

I was unable to use await fetch() nor fetch().then() on Node.js for this application.

Version this happens on:

The latest version available on the App Store & The Beta TestFlight

How to re-create

  1. Create a file called test.js
  2. Write down this code:
await fetch("https://jsonplaceholder.typicode.com/posts/1"); // Use any API
  1. Execute the file. You may need to allow ESM modules.

Error Dump

Solution 1 $ node /var/mobile/Containers/Data/Application/A3048ECB-6A9D-46F6-AC58-CDC31F18DB0B/Documents/node/Solutions/Solution 1/test.js
ReferenceError: WebAssembly is not defined
    at lazyllhttp (node:internal/deps/undici/undici:7804:9)
    at lib/client.js (node:internal/deps/undici/undici:7850:25)
    at __require (node:internal/deps/undici/undici:6:50)
    at lib/pool.js (node:internal/deps/undici/undici:9173:18)
    at __require (node:internal/deps/undici/undici:6:50)
    at lib/agent.js (node:internal/deps/undici/undici:9255:16)
    at __require (node:internal/deps/undici/undici:6:50)
    at lib/global.js (node:internal/deps/undici/undici:9376:17)
    at __require (node:internal/deps/undici/undici:6:50)
    at lib/fetch/index.js (node:internal/deps/undici/undici:9464:35)
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11730:11)
    at async file:///private/var/mobile/Containers/Data/Application/A3048ECB-6A9D-46F6-AC58-CDC31F18DB0B/Documents/node/Solutions/Solution%201/test.js:1:1 {
  cause: ReferenceError: WebAssembly is not defined
      at lazyllhttp (node:internal/deps/undici/undici:7804:9)
      at lib/client.js (node:internal/deps/undici/undici:7850:25)
      at __require (node:internal/deps/undici/undici:6:50)
      at lib/pool.js (node:internal/deps/undici/undici:9173:18)
      at __require (node:internal/deps/undici/undici:6:50)
      at lib/agent.js (node:internal/deps/undici/undici:9255:16)
      at __require (node:internal/deps/undici/undici:6:50)
      at lib/global.js (node:internal/deps/undici/undici:9376:17)
      at __require (node:internal/deps/undici/undici:6:50)
      at lib/fetch/index.js (node:internal/deps/undici/undici:9464:35)
}
  1. The code will not execute properly. Depending on how it is written, it will either gracefully handle the fetch or error out.
  2. A pattern I discovered is that you had to press the CTRL+C to quit the application, meaning that Node.js doesn’t quit.

BZ110 avatar Nov 07 '25 02:11 BZ110

Forgot to mention My device is: iPad Pro (11-inch) (4th generation) Model #: MNXD3VC/A

BZ110 avatar Nov 07 '25 02:11 BZ110