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

fetch API breaks existing module and adding --no-experimental-fetch fixes the problem #1566

Open
tomfinegan opened this issue May 24, 2022 · 2 comments
Labels

Comments

@tomfinegan
Copy link

Repro steps:

  1. Install node 18
  2. npm install draco3d
  3. change dir to draco3d install directory
  4. node draco_nodejs_example.js

Above fails:

$ node draco_nodejs_example.js
(node:16258) 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:4813
            throw new TypeError("Failed to parse URL from " + input, { cause: err });
                  ^

TypeError: Failed to parse URL from /Users/tomfinegan/tmp/node_modules/draco3d/draco_decoder.wasm
    at new Request (node:internal/deps/undici/undici:4813:19)
    at Agent.fetch2 (node:internal/deps/undici/undici:5539:29)
    ... 4 lines matching cause stack trace ...
    at Object.createDecoderModule (/Users/tomfinegan/tmp/node_modules/draco3d/draco_decoder_nodejs.js:39:247)
    at Object.<anonymous> (/Users/tomfinegan/tmp/node_modules/draco3d/draco_nodejs_example.js:29:9)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) {
  [cause]: TypeError [ERR_INVALID_URL]: Invalid URL
      at new NodeError (node:internal/errors:377:5)
      at URL.onParseError (node:internal/url:563:9)
      at new URL (node:internal/url:643:5)
      at new Request (node:internal/deps/undici/undici:4811:25)
      at Agent.fetch2 (node:internal/deps/undici/undici:5539:29)
      at Object.fetch (node:internal/deps/undici/undici:6370:20)
      at fetch (node:internal/bootstrap/pre_execution:196:25)
      at /Users/tomfinegan/tmp/node_modules/draco3d/draco_decoder_nodejs.js:39:1
      at /Users/tomfinegan/tmp/node_modules/draco3d/draco_decoder_nodejs.js:39:224
      at Object.createDecoderModule (/Users/tomfinegan/tmp/node_modules/draco3d/draco_decoder_nodejs.js:39:247) {
    input: '/Users/tomfinegan/tmp/node_modules/draco3d/draco_decoder.wasm',
    code: 'ERR_INVALID_URL'
  }
}

Node.js v18.2.0

Adding --no-experimental-fetch fixes the issue:

$ node --no-experimental-fetch draco_nodejs_example.js
Decoder Module Initialized!
Encoder Module Initialized!
Decoding file of size 96018 ..
Number of faces 69451
Number of vertices 34834
Adding POSITION attribute
Encoding...
Encoded size is 50135
The file was saved!

Draco is tracking this here: google/draco#888
One of our users encountered it and reported it here: CesiumGS/gltf-pipeline#613

@tleecode
Copy link

I've been having the same issue, this worked for me as well. Thanks!

skaldarnar added a commit to MovingBlocks/movingblocks.github.com that referenced this issue Jan 2, 2023
Due to octokit/request.js#526 and node-fetch/node-fetch#1566 we need to disable the experimental Fetch API introduced in Node.js 18.x.
skaldarnar added a commit to MovingBlocks/movingblocks.github.com that referenced this issue Jan 5, 2023
…y module info (#179)

- feat(source-terasology-module): custom source plugin to fetch Terasology module information
  - basic information: name, url, description,  homepageUrl
  - include URL to custom `cover` image if defined
  - parse `module.txt` and enrich it with `tags` (also skip repos without 'module.txt' on branch 'develop')
  - include content of `README.md`
- chore: build with `NODE_OPTIONS='--no-experimental-fetch'` to avoid warning about experimental Fetch API in Node 18.x (see octokit/request.js#526 and node-fetch/node-fetch#1566)
- doc(source-terasology-module): document basic usage of the source plugin
@gastonfournier
Copy link

Thanks! This saved my day!

gastonfournier added a commit to Unleash/unleash that referenced this issue Apr 18, 2023
## About the changes
This upgrades our main branch to use node 18 which is the active LTS
version and stops using node 14 which reaches the end of life in a few
weeks: https://nodejs.dev/en/about/releases/

This PR also adds `--no-experimental-fetch` for frontend tests and other
frontend commands. Related to:
node-fetch/node-fetch#1566

More about the experimental fetch release:
https://nodejs.org/en/blog/announcements/v18-release-announce#fetch-experimental
anoukhello added a commit to pass-culture/pass-culture-app-native that referenced this issue Aug 4, 2023
Lucasbeneston pushed a commit to pass-culture/pass-culture-app-native that referenced this issue Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants