Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when loading wasm-lz4 in Node 18 #8

Open
jtbandes opened this issue Nov 23, 2022 · 1 comment · May be fixed by #9
Open

Error when loading wasm-lz4 in Node 18 #8

jtbandes opened this issue Nov 23, 2022 · 1 comment · May be fixed by #9
Labels
bug Something isn't working

Comments

@jtbandes
Copy link

jtbandes commented Nov 23, 2022

Steps to reproduce:

$ docker run -it --rm node:18 /bin/bash
# mkdir test && cd test
# npm init -y && npm i wasm-lz4
# node -e 'require("wasm-lz4")'

Result:

(node:31) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/deps/undici/undici:11118
    Error.captureStackTrace(err, this);
          ^

TypeError: Failed to parse URL from /test/node_modules/wasm-lz4/wasm-lz4.wasm
    at Object.fetch (node:internal/deps/undici/undici:11118:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  [cause]: TypeError [ERR_INVALID_URL]: Invalid URL
      at new NodeError (node:internal/errors:393:5)
      at URL.onParseError (node:internal/url:565:9)
      at new URL (node:internal/url:645:5)
      at new Request (node:internal/deps/undici/undici:9472:25)
      at Agent.fetch2 (node:internal/deps/undici/undici:10291:25)
      at Object.fetch (node:internal/deps/undici/undici:11116:28)
      at fetch (node:internal/process/pre_execution:216:25)
      at instantiateAsync (/test/node_modules/wasm-lz4/wasm-lz4.js:9:8977)
      at createWasm (/test/node_modules/wasm-lz4/wasm-lz4.js:9:9587)
      at /test/node_modules/wasm-lz4/wasm-lz4.js:9:10837 {
    input: '/test/node_modules/wasm-lz4/wasm-lz4.wasm',
    code: 'ERR_INVALID_URL'
  }
}

Node.js v18.12.1

The same error does not occur when using Node 16.

This appears to be caused by emscripten-core/emscripten#16915, which was fixed in emscripten-core/emscripten#16917 (available in emscripten 3.1.13 and later), so it could likely be fixed by upgrading emscripten.

See also: foxglove/wasm-bz2#4

jtbandes added a commit to foxglove/ws-protocol that referenced this issue Nov 23, 2022
**Public-Facing Changes**
Added Node.js max version to `npx @foxglove/ws-protocol-examples`.

**Description**
Node 18 is not currently supported due to cruise-automation/wasm-lz4#8 & foxglove/wasm-bz2#4
@jtbandes jtbandes added the bug Something isn't working label Nov 29, 2022
@tjfrisch-swa
Copy link

This issue also appears in node 20+ from what I can tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
2 participants