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

npx @foxglove/ws-protocol-examples broken in Node 18 #281

Closed
jtbandes opened this issue Nov 23, 2022 · 8 comments
Closed

npx @foxglove/ws-protocol-examples broken in Node 18 #281

jtbandes opened this issue Nov 23, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@jtbandes
Copy link
Member

jtbandes commented Nov 23, 2022

Steps To Reproduce

$ docker run -it --rm node:18 /bin/bash
root@066e73a8e175:/# npx @foxglove/ws-protocol-examples@latest sysmon
Need to install the following packages:
  @foxglove/[email protected]
Ok to proceed? (y) y

Expected Behavior
Examples work

Actual Behavior

(node:28) 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 /root/.npm/_npx/d712c844522a0ed2/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 (/root/.npm/_npx/d712c844522a0ed2/node_modules/wasm-lz4/wasm-lz4.js:9:8977)
      at createWasm (/root/.npm/_npx/d712c844522a0ed2/node_modules/wasm-lz4/wasm-lz4.js:9:9587)
      at /root/.npm/_npx/d712c844522a0ed2/node_modules/wasm-lz4/wasm-lz4.js:9:10837 {
    input: '/root/.npm/_npx/d712c844522a0ed2/node_modules/wasm-lz4/wasm-lz4.wasm',
    code: 'ERR_INVALID_URL'
  }
}
@jtbandes jtbandes added the bug Something isn't working label Nov 23, 2022
@jtbandes jtbandes changed the title npx @foxglove/ws-protocol-examples broken in docker npx @foxglove/ws-protocol-examples broken in Node 18 Nov 23, 2022
@jtbandes
Copy link
Member Author

May be related to emscripten-core/emscripten#16915

@jtbandes
Copy link
Member Author

jtbandes commented Nov 23, 2022

@defunctzombie defunctzombie added bug Something isn't working and removed bug Something isn't working labels Dec 13, 2022
@foxhubber
Copy link

foxhubber bot commented Dec 13, 2022

Linear: FG-958

@jhurliman
Copy link
Contributor

cruise-automation/wasm-lz4#8 has been open for over two weeks without a response. Should we create @foxglove/wasm-lz4? Obtaining ownership of the non-prefixed wasm-lz4 package is a nice goal, but as of now the package appears to be abandonware.

@jhurliman
Copy link
Contributor

Fixed in #353

@LKSeng
Copy link

LKSeng commented Feb 16, 2023

I am using node 18.13.0. On Ubuntu 20.04.

When i tried npx @foxglove/ws-protocol-examples@latest sysmon, it throws the following:

node:internal/deps/undici/undici:14062
    Error.captureStackTrace(err, this);
          ^

TypeError: Failed to parse URL from /home/user/.npm/_npx/3bd6f606b8f372ab/node_modules/wasm-lz4/wasm-lz4.wasm
    at Object.fetch (node:internal/deps/undici/undici:14062:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  [cause]: TypeError [ERR_INVALID_URL]: Invalid URL
      at new NodeError (node:internal/errors:400: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:6914:25)
      at fetch2 (node:internal/deps/undici/undici:13228:25)
      at Object.fetch (node:internal/deps/undici/undici:14060:18)
      at fetch (node:internal/process/pre_execution:237:25)
      at instantiateAsync (/home/user/.npm/_npx/3bd6f606b8f372ab/node_modules/wasm-lz4/wasm-lz4.js:9:8977)
      at createWasm (/home/user/.npm/_npx/3bd6f606b8f372ab/node_modules/wasm-lz4/wasm-lz4.js:9:9587)
      at /home/user/.npm/_npx/3bd6f606b8f372ab/node_modules/wasm-lz4/wasm-lz4.js:9:10837 {
    input: '/home/user/.npm/_npx/3bd6f606b8f372ab/node_modules/wasm-lz4/wasm-lz4.wasm',
    code: 'ERR_INVALID_URL'
  }
}

Node.js v18.13.0

I went to the _npx folder and find that:

{
  "name": "@foxglove/ws-protocol-examples",
  "version": "0.4.0",
  "description": "Foxglove WebSocket protocol examples",
  "keywords": [
    "foxglove",
    "websocket",
    "robotics",
    "ros",
    "ros2"
  ],
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "https://github.com/foxglove/ws-protocol.git"
  },
  "author": {
    "name": "Foxglove Technologies",
    "email": "[email protected]"
  },
  "engines": {
    "node": ">= 14 <18"
  },
  "homepage": "https://foxglove.dev/",
  "module": "dist/esm/ws-protocol-examples/src/index.js",
  "main": "dist/cjs/ws-protocol-examples/src/index.js",
  "typings": "dist/esm/ws-protocol-examples/src/index.d.ts",
  "files": [
    "dist",
    "src"
  ],
  "bin": {
    "ws-protocol-examples": "dist/cjs/ws-protocol-examples/src/index.js"
  },
  "scripts": {
    "prepack": "yarn build",
    "build": "tsc -b tsconfig.json tsconfig.cjs.json",
    "lint": "eslint --report-unused-disable-directives --fix .",
    "lint:ci": "eslint --report-unused-disable-directives .",
    "test": "echo 'Nothing to test'",
    "run-example": "tsc -b ../*/tsconfig*.json && ts-node --project tsconfig.cjs.json --files src/index.ts"
  },
  "devDependencies": {
    "@foxglove/eslint-plugin": "0.20.0",
    "@foxglove/tsconfig": "1.1.0",
    "@types/debug": "^4.1.7",
    "@types/lodash": "^4.14.191",
    "@types/node": "^18.11.18",
    "@types/ws": "^8.5.4",
    "@typescript-eslint/eslint-plugin": "5.48.1",
    "@typescript-eslint/parser": "5.48.1",
    "eslint": "8.31.0",
    "eslint-config-prettier": "8.6.0",
    "eslint-plugin-es": "4.1.0",
    "eslint-plugin-filenames": "1.3.2",
    "eslint-plugin-import": "2.26.0",
    "eslint-plugin-jest": "27.2.1",
    "eslint-plugin-prettier": "4.2.1",
    "prettier": "2.8.2",
    "ts-node": "10.9.1",
    "typescript": "4.9.4"
  },
  "dependencies": {
    "@foxglove/rosmsg-serialization": "^1.5.3",
    "@foxglove/rosmsg2-serialization": "^1.1.1",
    "@foxglove/rostime": "^1.1.2",
    "@foxglove/schemas": "^0.7.3",
    "@foxglove/ws-protocol": "^0.3.2",
    "@mcap/core": "^0.3.0",
    "boxen": "^7.0.1",
    "commander": "^9.5.0",
    "debug": "^4",
    "eventemitter3": "^5.0.0",
    "protobufjs": "^7.1.2",
    "pureimage": "^0.3.15",
    "tslib": "^2",
    "wasm-lz4": "^2.0.0",
    "ws": "^8.12.0",
    "zstd-codec": "^0.1.4"
  }
}

I am not sure if this is due to using wasm-lz4 instead of @foxglove/wasm-lz4 as in package.json in main.

How do I fix this? TIA

@jtbandes
Copy link
Member Author

Looks like we forgot to publish a new version of the package after making the fix. I've just published 0.5.0 now, so give it another try!

@LKSeng
Copy link

LKSeng commented Feb 17, 2023

Thank you. I am happy to report that it works fine out of the box with npx @foxglove/ws-protocol-examples@latest sysmon and is currently at @foxglove/[email protected].

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

No branches or pull requests

4 participants