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 @foxglove/wasm-bz2 in Node 18 #4

Closed
jtbandes opened this issue Nov 23, 2022 · 0 comments · Fixed by #5
Closed

Error when loading @foxglove/wasm-bz2 in Node 18 #4

jtbandes opened this issue Nov 23, 2022 · 0 comments · Fixed by #5
Labels
bug Something isn't working

Comments

@jtbandes
Copy link
Member

Steps to reproduce:

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

Result:

(node:91) 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)
/test/node_modules/@foxglove/wasm-bz2/wasm/module.js:183
      throw ex;
      ^

TypeError: Failed to parse URL from /test/node_modules/@foxglove/wasm-bz2/wasm/module.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/@foxglove/wasm-bz2/wasm/module.js:1432:14)
      at createWasm (/test/node_modules/@foxglove/wasm-bz2/wasm/module.js:1464:3)
      at Object.default (/test/node_modules/@foxglove/wasm-bz2/wasm/module.js:2691:11) {
    input: '/test/node_modules/@foxglove/wasm-bz2/wasm/module.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: cruise-automation/wasm-lz4#8

@jtbandes jtbandes added the bug Something isn't working label Nov 23, 2022
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 added a commit that referenced this issue Nov 30, 2022
**Public-Facing Changes**
Upgrade emscripten to fix compatibility with Node 18.


**Description**
Fixes #4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

1 participant