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

"stream/web is an experimental feature" warning on Node 16.5.0 #1280

Closed
raisen opened this issue Sep 8, 2021 · 10 comments
Closed

"stream/web is an experimental feature" warning on Node 16.5.0 #1280

raisen opened this issue Sep 8, 2021 · 10 comments
Labels

Comments

@raisen
Copy link

raisen commented Sep 8, 2021

It looks like the warning below happens on Node 16.5.0. I tried with 14.17.4 and didn't get the warning.

(node:17339) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time

node --trace-warnings index.js
(node:17390) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
    at emitExperimentalWarning (node:internal/util:205:11)
    at node:stream/web:7:1
    at NativeModule.compileForInternalLoader (node:internal/bootstrap/loaders:312:7)
    at NativeModule.compileForPublicLoader (node:internal/bootstrap/loaders:252:10)
    at loadNativeModule (node:internal/modules/cjs/helpers:40:9)
    at Function.Module._load (node:internal/modules/cjs/loader:798:15)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/.../test/node_modules/fetch-blob/streams.cjs:7:31)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)

Reproduction

Steps to reproduce the behavior:

Create a index.js file:

import fetch from "node-fetch";

package.json:

{
  "name": "test",
  "type": "module",
  "dependencies": {
    "node-fetch": "^3.0.0"
  }
}

Expected behavior

Warning shouldn't display.

Your Environment

software version
node-fetch 3.0.0
node 16.5.0
npm 7.19.1
Operating System Linux

Additional context

@raisen raisen added the bug label Sep 8, 2021
@jimmywarting
Copy link
Collaborator

The warning comes from fetch-blob
it uses node's built in whatwg:stream first and formost and the polyfill as a fallback

We are also going to depend on it eventually in response.body but not yet...

as of now, closing as dupl of node-fetch/fetch-blob#114

@jimmywarting
Copy link
Collaborator

you can ignore it with --no-warning flag if u like.

@jeswin
Copy link

jeswin commented Oct 9, 2021

you can ignore it with --no-warning flag if u like.

But that's not a solution when running a script which uses node internally.

But even otherwise, this is probably not a good idea given the popularity of node-fetch in scripting. Scripts which were expecting to parse remote data will start failing.

@jeswin
Copy link

jeswin commented Oct 30, 2021

Sorry to bring this up again. I strongly disagree with the approach of breaking production apps by introducing support for experimental features in a mainline, non-alpha version - this package has 30 million weekly downloads on npm. I saw that a fix has been committed, but that looks a bit like a hack; the correct approach would be to not depend on unstable APIs instead of suppressing warnings.

Given the 30m downloads figure, there will be quite a few dependent apps which are console apps. Text is how data gets passed around (piped) between programs, this has broken all of them. In addition to making the output visually ugly.

Disclosure: I am the maintainer of bashojs, and this basically breaks my package. I can downgrade, which is what I'll probably do.

@jimmywarting
Copy link
Collaborator

@jeswin why does it break your package?
Why would it be so bad to depend on it?

@jeswin
Copy link

jeswin commented Oct 30, 2021

Here's a screenshot.

basho-output

  1. Users are expecting to see just "20". ( Now the warning goes to stderr, but the visual noise makes it unusable.)
  2. Scripts which process stderr will need to handle this warning.

Why would it be so bad to depend on it?

This is just my opinion, but experimental implies unstable. This warning breaks confidence (and it's quite visible to the end-users).

@jeswin
Copy link

jeswin commented Oct 30, 2021

Posting another screenshot to show how this affects usability (from one of our build scripts):

build-output

Marked in yellow is the only relevant detail the user needs to see.

@jimmywarting
Copy link
Collaborator

undici themself also use experimental web/stream
i belive it's better to depend on it rather than using web-streams-polyfill...

@jeswin
Copy link

jeswin commented Oct 30, 2021

Though I disagree, I understand your points (which you've made here, as well as that on the fetch-blob thread).

My scenario works with a downgrade to 2.6 (which I've done), so it doesn't block me or anything. Thanks.

@ParnishSharma
Copy link

working on Next.js the problem might be in your _app.js file.

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

4 participants