wasmerio / wasmer-js

Monorepo for Javascript WebAssembly packages by Wasmer
https://wasmerio.github.io/wasmer-js/
MIT License
943 stars 82 forks source link

init() - doesnt work, undici fetch failed. #442

Open ambrt opened 1 day ago

ambrt commented 1 day ago

Basically empty script with just init() doesn't work.

import { init } from "@wasmer/sdk";

async function run() {
  await init();

}
run();

Throws unidici error.

> wasmer-sdk-node-example@0.0.0 run
> node example.mjs

node:internal/deps/undici/undici:13178
      Error.captureStackTrace(err);
            ^

TypeError: fetch failed
    at node:internal/deps/undici/undici:13178:13
    at async v_ (file:///home/user/wasmer/examples/node_modules/@wasmer/sdk/dist/index.mjs:11:47648)
    at async R_ (file:///home/user/wasmer/examples/node_modules/@wasmer/sdk/dist/index.mjs:11:48139)
    at async run (file:///home/user/wasmer/examples/example.mjs:26:3) {
  [cause]: Error: not implemented... yet...
      at makeNetworkError (node:internal/deps/undici/undici:8961:35)
      at schemeFetch (node:internal/deps/undici/undici:10356:34)
      at node:internal/deps/undici/undici:10205:26
      at mainFetch (node:internal/deps/undici/undici:10224:11)
      at fetching (node:internal/deps/undici/undici:10172:7)
      at fetch (node:internal/deps/undici/undici:10041:20)
      at fetch (node:internal/deps/undici/undici:13176:10)
      at fetch (node:internal/bootstrap/web/exposed-window-or-worker:72:12)
      at v_ (file:///home/user/wasmer/examples/node_modules/@wasmer/sdk/dist/index.mjs:11:46947)
      at R_ (file:///home/user/wasmer/examples/node_modules/@wasmer/sdk/dist/index.mjs:11:48145)
}

Node.js v23.2.0

It related to https://github.com/nodejs/undici/issues/2751

syrusakbary commented 14 hours ago

What version of Node are you using @ambrt ?