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

Node experimental feature warning leaking to CLI #4608

Closed
danisztls opened this issue May 13, 2022 · 7 comments
Closed

Node experimental feature warning leaking to CLI #4608

danisztls opened this issue May 13, 2022 · 7 comments
Labels
type: bug code to address defects in shipped code

Comments

@danisztls
Copy link

Describe the bug

The following warning appear when I run netlify-cli.

(node:359487) 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)

Steps to reproduce

Run netlify status.

Note: Also happens with other commands

Configuration

None.

Environment

System:
OS: Linux 5.17 Arch Linux
CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
Memory: 6.53 GB / 15.61 GB
Container: Yes
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.1.0 - /bin/node
Yarn: 1.22.18 - /bin/yarn
npm: 8.5.5 - /bin/npm
npmGlobalPackages:
netlify-cli: 10.3.1

@danisztls danisztls added the type: bug code to address defects in shipped code label May 13, 2022
@tinfoil-knight
Copy link
Contributor

tinfoil-knight commented Aug 23, 2022

NodeJS currently doesn't allow suppressing individual categories of warning. There are multiple feature requests to do this in NodeJS: nodejs/node#40940, nodejs/node#30810.

But, all warnings can be disabled by:

  • setting NODE_NO_WARNINGS=1 OR
  • by passing the --no-warnings to the nodejs executable OR
  • using process.removeAllListeners('warning')

@minivan Do you think we should fix this now? (Since this'll also remove warnings for deprecated feature use, unhandled promise rejections, memory leak detection for event emitter, custom warnings created through process.emitWarning etc. which could make debugging things hard.)

Ref:
https://nodejs.org/api/cli.html#node_no_warnings1
https://nodejs.org/api/cli.html#--no-warnings

@minivan
Copy link
Contributor

minivan commented Aug 23, 2022

oh, if it's a node issue then I don't think we need to do anything 😢

@danez
Copy link
Contributor

danez commented Aug 26, 2022

This is fixed with #4998

Once the next release is published it will go away.

@danez danez closed this as completed Aug 26, 2022
@AgentEnder
Copy link

@tinfoil-knight Excuse me from necroing this a bit, I wanted to put forth an idea. Do you think it would be reasonable, as a library author, to use something like this to selectively remove warnings? I stumbled across this issue while dealing with a similar problem for a library I maintain, its just something I wanted to think about 🤔.

I don't see a huge issue with it, and it makes it pretty clear that you are explicitly ignoring a class of warnings.

process.removeAllListeners('warning');
process.on('warning', (l) => {
  if (l.name !== 'ExperimentalWarning') {
	console.warn(l)
  }
});

fetch('some-url').catch(() => {});

@tinfoil-knight
Copy link
Contributor

@AgentEnder Considering that process is global, you'd end up hiding the warnings in any codebase where your library is used AFAIK. Seems slightly problematic to me.

@AgentEnder
Copy link

Huh, yeah that definitely makes sense. I think as the author of CLI tooling, that should be fine, just not as a library-type dependency.

For instance, I work on Nx. If we were to do that I think it'd be fine (we don't need to right now of course), but I wouldn't want a plugin author to do that.

@Azzedine-zemmari
Copy link

hy i have the same problem but where should I pass --no-warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

6 participants